Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sendmail transport is broken in 8.1.3 #19110

Closed
zerkms opened this issue Sep 16, 2015 · 6 comments
Closed

Sendmail transport is broken in 8.1.3 #19110

zerkms opened this issue Sep 16, 2015 · 6 comments
Assignees
Labels
Milestone

Comments

@zerkms
Copy link

zerkms commented Sep 16, 2015

In the mailer.php that's how email is sent:

$mailer->send($message->getSwiftMessage(), $failedRecipients);

where $mailer in an instance of Swift_SendmailTransport (that is created with return \Swift_SendmailTransport::newInstance($binaryPath . ' -bs');)

The problem is that the transport must be started with the start() method, otherwise its buffers are not initialized.

It's not obvious why the OC uses the transport directly without Swift_Mailer, which handles it properly: https://github.com/swiftmailer/swiftmailer/blob/5.x/lib/classes/Swift/Mailer.php#L78

https://www.dropbox.com/s/7rdogx7r3ct4gmo/screenshot-oc.png?dl=0

On the screenshot you can see that the in/out streams are not initialized, so transport cannot function properly.

@karlitschek
Copy link
Contributor

@LukasReschke what do you think?

@LukasReschke LukasReschke self-assigned this Sep 17, 2015
zuazo added a commit to zuazo/owncloud-cookbook that referenced this issue Sep 19, 2015
@LukasReschke
Copy link
Member

@zerkms Thanks a lot for your bug report.

I tried to initialize the transport there manually as well but this doesn't seem to work reliably:

    /**
     * Returns the sendmail transport
     *
     * @return \Swift_SendmailTransport
     */
    protected function getSendMailInstance() {
        switch ($this->config->getSystemValue('mail_smtpmode', 'sendmail')) {
            case 'qmail':
                $binaryPath = '/var/qmail/bin/sendmail';
                break;
            default:
                $binaryPath = '/usr/sbin/sendmail';
                break;
        }

        $transport = \Swift_SendmailTransport::newInstance($binaryPath . ' -bs');
        $transport->start();
        return $transport;
    }

May I ask you whether #19047 would be sufficient for you as well? If you have alternative suggestions I'd greatly appreciate and welcome a Pull Request or some hints. 😃

@zerkms
Copy link
Author

zerkms commented Sep 21, 2015

@LukasReschke why not use Swift_Mailer instance instead? Not sure about portability, but that's what I use for years (my environments are not very different from one another though)

@LukasReschke
Copy link
Member

@LukasReschke why not use Swift_Mailer instance instead? Not sure about portability, but that's what I use for years (my environments are not very different from one another though)

So you would propose return Swift_Mailer::newInstance($transport)? - Let me test this on some machines and come up with a PR if it works on all.

@zerkms
Copy link
Author

zerkms commented Sep 21, 2015

At least how Swift mailer developers suggest us to do that :-)

http://swiftmailer.org/docs/sending.html

@MorrisJobke MorrisJobke added this to the 8.2-current milestone Oct 12, 2015
@MorrisJobke
Copy link
Contributor

Fixed with #19657

@lock lock bot locked as resolved and limited conversation to collaborators Aug 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

4 participants