Source: https://support.google.com/accounts/answer/185833
sudo vim /etc/postfix/main.cfAdd the following lines, anywhere really, but preferably under the relayhost section:
relayhost = smtp.gmail.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtp_sasl_mechanism_filter = plainsudo vim /etc/postfix/sasl_passwdAdd the following information. Note update and with your information
smtp.gmail.com:587 <username>@gmail.com:<password>
sudo chmod 600 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
sudo launchctl stop org.postfix.master
sudo launchctl start org.postfix.master$ echo "Hello" | mail -s "Test" <someone>@gmail.com
tail -f /var/log/mail.logor
log stream --predicate '(process == "smtpd") || (process == "smtp")' --info