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

[Mailer] Fix sendmail transport not handling failure #54239

Merged
merged 1 commit into from Mar 12, 2024

Conversation

aboks
Copy link
Contributor

@aboks aboks commented Mar 11, 2024

Q A
Branch? 5.4
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

I found out that the Mailer component SendmailTransport does not detect all failures. The ProcessStream checks stderr when the process is started, but it does not check the exit code and output afterwards. This could lead to silent failures.

We found this out due to having sendmail_path = "/usr/bin/msmtp -t --read-envelope-from" in php.ini, but msmtp does not like --read-envelope-from in combination with the -f option added by Symfony Mailer. In this case, msmtp fails with exit status 64 and a message on stdout (rather than stderr). The latter is the reason why I also added the stdout output to the error message (along with the stderr output).

Feel free to modify this PR to bring it more in line with existing standards and conventions. The most important part to me is that a failure like this is detected and the mailer does not silently fail.

@nicolas-grekas
Copy link
Member

Thank you @aboks.

@nicolas-grekas nicolas-grekas merged commit 864df6f into symfony:5.4 Mar 12, 2024
8 of 12 checks passed
This was referenced Apr 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants