Saturday, August 06, 2022

sending mail from GMail smtp servers instead of postfix

Our internal server used to send us notification emails for various server tasks. Recently, our server started getting blocked by GMail with 550-5.7.1 "likely unsolicited mail". Since setting up a "proper" smtp server with reverse DNS, DKIM signing, etc etc would be more painful than just using GMail SMTP servers, we preferred using one of the solutions below - 
or

Since our server scripts were bash scripts and not PHP scripts, we used the latter. 
sudo apt install ssmtp
(which would remove postfix)
and modifying the configuration file as in the link above, /etc/ssmtp/ssmtp.conf with
mailhub=smtp.gmail.com:587
AuthUser=ouruser@ourdomain.org
AuthPass=ourpassword
useSTARTTLS=YES
useTLS=YES

(and allow less secure apps must be enabled on that account.)

With that, the notification emails from our server resumed. 

No comments:

Post a Comment