smtp relayhost in OS X Yosemite

In order to send mail from a localhost, you would need to enable the smtp server as a host.

First you would have to edit the file to add in the relayhost

sudo vim /etc/postfix/

//Add the below code to after the commented relayhost code

relayhost = []:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes

Next you would have to generate a sasl_password if it doesn’t exist

sudo vim /etc/postfix/sasl_passwd

add in the below to sasl_passwd


Lastly restart the postfix

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

You might want to consider using sudo su - since root access is required for all the above operations.

Credit given to Anuj Gakhar.
Although the article was for Lion, it works for Yosemite too.

This entry was posted in Web Development and tagged , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s