Email service configuration on Mac

These instructions explain how to setup an automatic email sending functionality on Mac. This service can be called programmatically. The example uses gmail as an email box, but all other email boxes can be used as well.

Navigate to the Mac OS directory


and edit a file Open it with the command

$ sudo nano

and add the following lines to the

# new additions here


# Minimum Postfix-specific configurations.
mydomain_fallback = localhost
mail_owner = _postfix
setgid_group = _postdrop

# Enable SASL authentication in the Postfix SMTP client.

# Enable Transport Layer Security (TLS), i.e. SSL.

Create a file sasl_passwd and place it into the /etc/postfix/ -folder

$ sudo nano sasl_passwd

and add a line your_gmail_address:password

Restart the postfix service

$ sudo postmap /etc/postfix/sasl_passwd
$ sudo postfix stop
$ sudo postfix start

Now the email service should be ready to use. You may test the service with the command

$ echo 'Hello World!' | mail -s testing your_gmail_address

Back to the main page.