SSMTP send off
If you are unlucky enough to work in a corporate environment where they don't trust your Linux machine to send mail, you probably need to relay to some fucked up Exchange server like http://www.themessagecenter.com/ provide. Poor you.
Since SSMTP sucks, since:
- cron jobs didn't seem to work on ssmtp
- does not provide per user config
- lots of bugs
- the fact that's SSMTP is no longer developed since 2009
I spent a morning migrating from /etc/ssmtp/ssmtp.conf
to ~/.msmtprc
. The
reason why it took so long as msmtp's "auth on" didn't work and after a LOT of
debugging, I found the solution to be auth login.
So this is my ~/.msmtprc
:
logfile ~/.msmtp.log
auth login
from kai.hendry@example.com
host mail.securembox.com
user kai.hendry@example.com
password secret
My old /etc/ssmtp/ssmtp.conf
hendry@deb02:~$ grep -v "^#" /etc/ssmtp/ssmtp.conf | grep .
root=hendry
mailhub=mail.securembox.com
AuthUser=kai.hendry@example.com
AuthPass=secret
hostname=deb02.jil.org
FromLineOverride=Yes
You can tell you have authorisation problem with your relay if your spits out like "550 5.7.1 Unable to relay".
Jan 31 10:49:22 host=mail.securembox.com tls=off auth=off from=kai.hendry@example.com recipients=kai.hendry@foo.org smtpstatus=550 smtpmsg='550 5.7.1 Unable to relay' errormsg='recipient address kai.hendry@foo.org not accepted by the server' exitcode=EX_DATAERR
The "auth=off" should be a dead giveaway.
Debug tips
With thanks from https://wiki.archlinux.org/index.php/MSMTP.
Test mail:
$ cat test.mail
To: kai.hendry@foo.org
From: kai.hendry@example.com
Subject: A test
Yadda, yadda, yadda
SSMTP debugging:
cat test.mail | /usr/sbin/ssmtp -d5 kai.hendry@foo.org
the MSMTP log to compare to:
cat test.mail | msmtp -d kai.hendry@foo.org