Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the '10.5: Send mail from Terminal using mail/sendmail' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
10.5: Send mail from Terminal using mail/sendmail
Authored by: anton on May 02, '11 03:01:18PM
I found this hint very useful and wanted to illustrate its use based on the example of gmail as your outgoing SMTP server. Here is the content of my main.cf file:

smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtp_tls_CAfile = /System/Library/OpenSSL/certs/cert.pem


As you can see I didn't use parameter, which appears to be not required for gmail.

smtp_tls_per_site = hash:/etc/postfix/smtp_tls_sites

The content of /etc/postfix/sasl_passwd file is

[smtp.gmail.com]:587 your_email@gmail.com:your password

after you create the file issue

sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd


Generate the certificate (this was copied from post above)

sudo security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain > /System/Library/OpenSSL/certs/cert.pem

Finally restart Postfix for good measure

sudo Postfix stop
sudo Postfix start


Thats it. You can now send email though gmail.

[ Reply to This | # ]