- A Mac running OSX 10.11.6
- MAMP v3.5
- PHP 7.0.0 (comes inside the MAMP v3.5 above)
Note
You'll see a lot of warnings in your Terminal throughout this process. That's normal.
sudo nano /etc/postfix/main.cf
Add this at the end of the file:
myorigin = live.com
myhostname = smtp.live.com
relayhost = smtp.live.com:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_mechanism_filter = plain
inet_protocols = ipv4
smtp_use_tls = yes
smtp_tls_security_level=encrypt
tls_random_source=dev:/dev/urandom
sudo nano /private/etc/postfix/master.cf
Uncomment this line (remove the #)
tlsmgr unix – – n – 1000? tlsmgr
sudo nano /etc/postfix/sasl_passwd
Add this line to it:
smtp.live.com:587 your_hotmail_username@hotmail.com:your_hotmail_password
Run the following commands in Terminal, one by one:
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
sudo postfix upgrade-configuration
sudo postfix reload
sudo postfix flush
nano /Applications/MAMP/conf/php[version.you.use]/php.ini
Find this section:
[mail function]
; For Win32 only.
SMTP = localhost
smtp_port = 25
; For Win32 only.
; sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
; sendmail_path =
And replace with:
[mail function]
; For Win32 only.
; SMTP = localhost
; smtp_port = 25
; For Win32 only.
; sendmail_from = me@example.com
; For Unix only. You may supply arguments as well (default: "sendmail -t -i").
sendmail_path =/usr/sbin/sendmail -t -i -f your_hotmail_username@hotmail.com
To test, send an e-mail from Terminal using this command:
date | mail -s test your_another_email@example.com
It will take few seconds before you will the email.
Re-start your MAMP server and try to run the PHP mail() script. It should work.
Hey I tried following this but I am getting this error:
danales-MacBook-Pro:Projects danale$ sudo postfix reload postfix: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all /usr/sbin/postconf: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all postfix/postlog: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all postfix/postfix-script: fatal: the Postfix mail system is not running danales-MacBook-Pro:Projects danale$ sudo postfix flush postfix: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all /usr/sbin/postconf: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all postqueue: warning: /etc/postfix/main.cf, line 696: overriding earlier entry: inet_protocols=all postqueue: fatal: Cannot flush mail queue - mail system is down danales-MacBook-Pro:Projects danale$