Send email via Postfix
I like sending brief email via the command line, because it really sucks to open a web browser just for writing 2 lines of text. On my old computer, I configured postfix to work with my gmail account. Now, I tried to replicate my config on my MacBook, but the SSL certificates used by Gmail have changed in the meantime, and although my configuration still works I end up with unwanted warnings in my /var/log/mail.log
.
When I first configure postfix, I used the Thawtee certificates. Basically, you should get a copy of Thawte_Premium_Server_CA.pem. Now, Gmail has changed this and you should use Equifax, Equifax_Secure_CA.pem, which can be found on DigiCert Trusted Root Authority Certificates.
Everything went fine by following these basic steps:
-
Create
relay_password in /etc/postfix
and edit assmtp.gmail.com login@gmail.com:password
, then $sudo postmap /etc/postfix/relay_password
to update Postfix lookup table. -
Add the certificates in
/etc/postfix/certs
, or any folder you like, then $sudo c_rehash /etc/postfix/certs/
(i.e., rehash the certificates with Openssl). -
Edit
/etc/postfix/main.cf
so that it includes the following lines:
Then, just reload the Postfix process, with e.g. $ sudo postfix reload
(a combination of start/stop works too).
Now, we can test that everything is working properly:
You can choose a different port for the SMTP, e.g. 465. It’s still possible to use SASL
without TLS
(the above steps are basically the same), but in both case the main problem is that your login informations are available in a plan text file.
My site is free of ads and trackers. Was this post helpful to you? Why not
Reference:
Disqus is great for comments/feedback but I had no idea it came with these gaudy ads.