Sunday, May 09, 2010

 

mailx, msmtp and gmail

So we wanted to send automated emails out from our ubuntu server via gmail. We found a recipe and all was fine...till google changed their certificate. We had sort of blindly followed directions, which included downloading a single CA certificate, and pointing msmtp to that one cert.

(From the comment below, I'm guessing our recipe came from http://philogroky.blogspot.com/2009/08/fixing-msmtp-to-send-mails-via-gmail.html, so you may want to start there to see the early steps for mailx and msmtp...though if you're on ubuntu, think you'll be set with sudo apt-get install msmtp bsd-mailx (or some other flavor of mailx)...

We eventually caught on and realized that was silly when we had a whole slew of CA certificates that we already trusted on the server. So instead, point msmtp to that!

So here's our .msmtp file and we've been pretty happy ever since!:



account gmail
auth on
host smtp.gmail.com
port 587
user ouraccount@somedomain.com
password somepassword
from ouraccount@somedomain.com
tls on
tls_starttls on
# tls_trust_file argument is the full path to the certificate
# changed to this as suggested on
# http://philogroky.blogspot.com/2009/08/fixing-msmtp-to-send-mails-via-gmail.html
# hopefully never have to update this stupid thing again...
tls_trust_file /etc/ssl/certs/ca-certificates.crt
maildomain gmail.com
account default : gmail

This page is powered by Blogger. Isn't yours?