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

ssmtp corrupting email attachments when server is under load #542

Open
drasgardian opened this issue Feb 16, 2023 · 1 comment
Open

ssmtp corrupting email attachments when server is under load #542

drasgardian opened this issue Feb 16, 2023 · 1 comment

Comments

@drasgardian
Copy link

By default, mail is sent via ssmtp:

PHP_SENDMAIL_PATH: '"/usr/bin/dos2unix -u | /usr/sbin/ssmtp -t -f"'

PROBLEM: If sending large emails (i.e. with attachments), and the server is under load, such as doing bulk emailing, ssmtp can corrupt the files.

When the system is under load, because of the way php's fwrite works, streaming input into the ssmtp has many more chunks, which increases the likelyhood of the input breaking at a point that causes ssmtp to corrupt the file. Unfortunately the behaviour can be quite intermittent.

A workaround I found was to use the sponge command.

PHP_SENDMAIL_PATH: '"/usr/bin/dos2unix -u | sponge | /usr/sbin/ssmtp -t -f"'

Sponge will "soak up" the input before passing to ssmtp in one go.

sponge is available from the moreutils library, which is not installed in the container by default.

@csandanov
Copy link
Member

Thank you for reporting this, this does sound plausible, but were you able to consistently reproduce that this actually fixes the issue? We should come up with some simple local test that demonstrates the issue before introducing new changes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants