Score:0

ssmtp don't work and don't want to log

pk flag

I've configured SSMTP to send mail, but the problem is that i can't send mail from my webserver and there is no logs in /var/log. Sometimes, i've got Sender mismatch in apache logs.

My config : Debian 11, and webserver into a Docker container.

This is my config of SSMTP :

hostname=domain.fr
[email protected]
mailhub=mail.infomaniak.com:587
[email protected]
AuthPass=PASS
UseTLS=YES
UseSTARTTLS=YES
Debug=YES

Into revaliases i've got :

www-data:[email protected]:mail.infomaniak.com:587
root:[email protected]:mail.infomaniak.com:587

EDIT : This is the part in my Dockerfile where I install and configure SSMTP :

&& apt -y install ssmtp mailutils \
&& echo "hostname=domain.fr" > /etc/ssmtp/ssmtp.conf \
&& echo "[email protected]" >> /etc/ssmtp/ssmtp.conf \
&& echo "mailhub=mail.infomaniak.com:587" >> /etc/ssmtp/ssmtp.conf \
&& echo "[email protected]" >> /etc/ssmtp/ssmtp.conf \
&& echo "AuthPass=" >> /etc/ssmtp/ssmtp.conf \
&& echo "UseTLS=YES" >> /etc/ssmtp/ssmtp.conf \
&& echo "UseSTARTTLS=YES" >> /etc/ssmtp/ssmtp.conf \
&& echo "Debug=YES" >> /etc/ssmtp/ssmtp.conf \
&& echo "www-data:[email protected]:mail.infomaniak.com:587" >> /etc/ssmtp/revaliases

For information, in CLI i can send emails while i'm on root account.

What could be my problem ?

Thanks for your help !

in flag
How did you configure the mail server inside the docker container?
Mathéo Tichy avatar
pk flag
I've edited my original post with the content of my Dockerfile :)
jp flag
SSMTP logs through syslog but you probably don't have it inside the docker container.
Mathéo Tichy avatar
pk flag
@AlexD is there a possibility to have at least these logs ? What can i do ? I'm quite lost now
jp flag
You can mount `/dev/log` from the host into the container.
Mathéo Tichy avatar
pk flag
@AlexD Do you mean `/var/log` instead of `/dev/log` ? I don't have it in my container
jp flag
I mean `/dev/log`. It is a socket used for `syslog` logging.
Mathéo Tichy avatar
pk flag
@AlexD I have mount `/dev/log` on my container (`--mount type=bind,src=/dev/log,dst=/dev/log`) but there is no more logs. For the error that I can have in apache is : `sendmail: 550 5.7.1 Sender mismatch`
jp flag
You should look for logs in your host `/var/log/mail.log`.
Mathéo Tichy avatar
pk flag
Thanks @AlexD ! Logs are working, but the error is not very helpful... ```550 5.7.1 Sender mismatch Can't open /var/www/dead.letter failing horribly!``` I don't know if the second line is a warning or a real error
jp flag
The message means that your target mail server (`mailhub=mail.infomaniak.com:587`) rejected the message with `550 5.7.1 Sender mismatch`. Also, `SSMTP` tried to save the message in `/var/www/dead.letter` but failed, probably due to file permissions.
Score:0
jp flag

The message 550 5.7.1 Sender mismatch means that your target mail server (mailhub=mail.infomaniak.com:587) rejected a mail sent by SSMTP. Also, SSMTP tried to save the message in /var/www/dead.letter but failed, probably due to file permissions.

You need to check logs mail.infomaniak.com to find out why it is rejecting your emails. You can also check dead.letter to ensure that it contains correct headers. You'll need to set the home directory for the user SSMTP running as to a directory where it has write permissions.

Score:0
pk flag

I've solved my problem after a lot of work !

If you have the same problem, to activate logs I mount /dev/log and /var/www to the container.

The server had a problem while writing into /var/www/dead.letter so I've created this file and put 777 permissions (for the test).

And finally, to solve 550 5.7.1 Sender mismatch I asked to my email host to know what was the problem (I discovered that my email was blocked by their servers). And the problem (for Infomaniak.com) was that the sender and contact email was different than the domain used.

Thanks to every people that helped me !

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.