- 14.1.1 Sonoma
sudo vim /etc/postfix/sasl_passwd- Add this to the file
smtp.gmail.com:587 [email protected]:APP_PASSWORDReplace EMAIL with your gmail username and replace APP_PASSWORD with the App password you generated in step 1
- Create a lookup table
sudo postmap /etc/postfix/sasl_passwd
- Open postfix's
main.cf
sudo vim /etc/postfix/main.cf
``
+ Add these fields at the end of the file
```bash
#Gmail SMTP
relayhost=smtp.gmail.com:587
# Enable SASL authentication in the Postfix SMTP client.
smtp_sasl_auth_enable=yes
smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options=noanonymous
smtp_sasl_mechanism_filter=plain
# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls=yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandomPostfix should start automatically when sending mail
Test by sending a mail
echo "Postfix setting test" | mail -s "Hello Postfix" "[email protected]"Replace [email protected] with the email id of recipent.
mailq: Check mails in the queue and errors if mail not sent.sudo postfix flush: Flush the queue.sudo postsuper -d ALLDelete mails in the queue.sudo rm /var/mail/$USERRemove all mails from local host.sudo postfix startStart postfix mail system.sudo postfix stopStop postfix mail system.sudo postfix reloadReload postfix mail system.