Deliver macOS system mail with the following instructions. These instructions apply to macOS Catalina.

Why would you want to do this?

  • You have cron jobs running on your system and want to receive emails when they fail.
  • You want an email when certain things happen on your system through Automator or other means.

Instructions

Edit the /etc/postfix/sasl_passwd file

sudo vi /etc/postfix/sasl_passwd

Add this line of text, and create an app password.

[smtp.gmail.com]:587 <Your Email Id>@gmail.com:<Your App Password>

Run the postfix lookup table management command

sudo postmap /etc/postfix/sasl_passwd

Edit the /etc/postfix/main.cf file

sudo vi /etc/postfix/main.cf

Add these properties to the bottom of the file.

# Gmail SMTP relay
relayhost = [smtp.gmail.com]:587

# Enable SASL authentication in the Postfix SMTP client.
smtpd_sasl_auth_enable = yes
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options =
smtp_sasl_mechanism_filter = AUTH LOGIN

# Enable Transport Layer Security (TLS), i.e. SSL.
smtp_use_tls = yes
smtp_tls_security_level = encrypt
tls_random_source = dev:/dev/urandom

Test delivery of mail from your system

date | mail -s "Test Email" <Your Email Id>@gmail.com

If you don’t receive an email, run this command before the previous command to debug the problem.

log stream --predicate  '(process == "smtpd") || (process == "smtp")' --info