- Source: http://www.developerfiles.com/how-to-send-emails-from-localhost-mac-os-x-el-capitan/
- Source: http://budiirawan.com/install-mail-server-mac-osx/
- Source: https://apple.stackexchange.com/questions/32228/whats-the-correctly-way-to-make-postfix-run-permanently-on-lion-not-server
sudo vi /etc/postfix/main.cf
- Ensure that the following values are set:
mail_owner = _postfix setgid_group = _postdrop
- Add the following lines at the end of the file:
# Postfix as relay # #Gmail SMTP relayhost=smtp.gmail.com:587 #Hotmail SMTP #relayhost=smtp.live.com:587 #Yahoo SMTP #relayhost=smtp.mail.yahoo.com:465 # Enable SASL authentication in the Postfix SMTP client. smtp_sasl_auth_enable=yes smtp_sasl_password_maps=hash:/etc/postfix/sasl_passwd smtp_sasl_security_options=noanonymous smtp_sasl_mechanism_filter=plain # Enable Transport Layer Security (TLS), i.e. SSL. smtp_use_tls=yes smtp_tls_security_level=encrypt tls_random_source=dev:/dev/urandom
sudo sh -c 'echo "\nsmtp.gmail.com:587 [email protected]:your_password" >> /etc/postfix/sasl_passwd'
Replace [email protected] and your_password with actual values.sudo postmap /etc/postfix/sasl_passwd
-
Copy the postfix master plist out of System folder.
sudo cp /System/Library/LaunchDaemons/com.apple.postfix.master.plist /Library/LaunchDaemons/org.postfix.custom.plist
-
sudo vi /Library/LaunchDaemons/org.postfix.custom.plist
-
Change the label value from
com.apple.postfix.master
toorg.postfix.custom
Remove these lines to prevent exiting after 60s
<string>-e</string> <string>60</string>
Add these lines before
</dict>
<key>KeepAlive</key> <true/> <key>RunAtLoad</key> <true/>
-
Relaunch the daemon.
sudo launchctl unload /Library/LaunchDaemons/org.postfix.custom.plist sudo launchctl load /Library/LaunchDaemons/org.postfix.custom.plist
-
Check that daemon has started.
sudo launchctl list | grep org.postfix
In Gmail we must switch on the option "Access for less secure apps", otherwise we will get the error:
SASL authentication failed
-
echo "Test sending email from Postfix" | mail -s "Test Postfix" [email protected]
Change
[email protected]
with valid email with mailbox access for easy checking. -
Check mail queue and possible delivery errors with
mailq
. -
Check mail log with
tail -f /var/log/mail.log
.
mutt is working via shell, but not with my php.mail() function
is there any additional settings to do or maybe in mamp pro conf or in php.ini file?
thank you for your help david