SSMTP was working for years now on my RPi - latest on stretch. Now I migrated to buster - and after this step it now fails.
$ cat /etc/ssmtp/ssmtp.conf
[email protected]
mailhub=smtp.gmail.com:587
hostname=localhost
UseSTARTTLS=YES
[email protected]
AuthPass=very_secret
FromLineOverride=YES
$ echo "MailBody"|mail --debug-level=3 -s "My Subject" [email protected]
mail: sendmail binary: /usr/sbin/sendmail
mail: source=system, name=user, passwd=x, uid=1001, gid=1000, gecos=user,,,, dir=/home/user, shell=/bin/bash, mailbox=/var/mail/user, quota=0, change_uid=1
mail: source=system, name=user, passwd=x, uid=1001, gid=1000, gecos=user,,,, dir=/home/user, shell=/bin/bash, mailbox=/var/mail/user, quota=0, change_uid=1
mail: mu_mailer_send_message(): using From: user@localhost
mail: Sending headers...
mail: Sending body...
mail: /usr/sbin/sendmail exited with: 1
mail: progmailer error: Process exited with a non-zero status
mail: cannot send message: Process exited with a non-zero status
mail: source=system, name=user, passwd=x, uid=1001, gid=1000, gecos=user,,,, dir=/home/user, shell=/bin/bash, mailbox=/var/mail/user, quota=0, change_uid=1
$ echo $?
36
I have a lot of shell-scripts sending mails with commands like:
echo "MailBody"|mail -s "My Subject" [email protected]
=> so if SSMTP is no longer supported, I would neeed a solution following that syntax ...
thanks for any help!
I fixed this by switching away from ssmtp (which some sources say being unmaintained) to msmtp (https://wiki.debian.org/msmtp).
This could or could not apply to you, try to check the error code by sending an email directly via
/usr/sbin/ssmtp -v ...., I had exit 36 (echo $?to get the code).If you are in a similar situation and want to give msmtp a try, these the steps I followed:
Install:
Configure (I'm not configuring GMail, I use Dreamhost email service, so your details might be different):
For comparison, this was my
/etc/ssmtp.conffile:Set msmtp as default MTA. I've added the last line to my mail.rc file:
[NOTE]: There is also an issue with msmtp in that it's not populating automatically the "From:" header in the message so emails get rejected, to fix it, when calling
mailmake sure to do it manually:This makes email sending work again from my Raspberry Pi on Debian buster/sid.