In an earlier blog post, I described how to use mail with Mageia Linux to send system messages to your Google Mail account. At the time, sendmail was the default MTA (mail transfer agent) of choice and was overkill for what was needed for a simple messaging of security status ( from msec). It still works.
By Mageia 8, postfix became the default MTA, so it seems it would be easier to configure postfix to use the Google Mail smtp relay server.
Postfix and all necessary dependencies are installed by Mageia by default. Mageia builds their RPM of postfix with specific options, which are:
Smtpd multiline greeting: --%{with_TXT multiline}
Virtual Delivery Agent: --%{with_TXT VDA}
Munge bare CR: --%{with_TXT barecr}
TLS support: --%{with_TXT tls}
IPV6 support: --%{with_TXT ipv6}
CDB support: --%{with_TXT cdb}
Chroot by default: --%{with_TXT chroot}
If you need other options for some other purpose, you can rebuild the source RPM (which is beyond the scope of this post).
It is necessary, due to security changes with Google Mail, to create an App Password for postfix. Open this link to manage your account and security settings (assuming you are already logged into your GMail account) then click on 2-Step verification to enable it (if not enabled). Access App Passwords to generate 16-character password to be used by postfix.
Open or create /etc/postfix/sasl/sasl_passwd file and then add SMTP Host, username, and password detail:
RESOURCES
A Comprehensive Guide to Connect Postfix to Gmail Account
3 easy steps to configure gmail smtp relay with postfix
Configuring an Ubuntu Postfix Server to Send Email through Gmail or Google Workspace
POSTFIX Troubleshooting
POSTFIX Homepage
GMail HOWTO at MaximumHoyt
Comments