For those of you who use MAMP and cannot send mail from the php mail () function because port 25 is blocked by ISP (in my case), here is some information for you. since OSX uses postfix to send emails, and if you plan on using an external smtp server like smtp.gmail.com, which I used here, this is what you should do. you need to configure Postfix to use Gmail as a relay host
a) Open MAMP and in postfix change the outgoing mail domain to smtp.gmail.com
b) open a terminal and enter sudo vi /etc/postfix/main.cf , this will ask the administrator password to enter it and it will open main.cf in the vi editor
c) press ctrl + f and go to the end of the file and move the cursor down one line and press a , now the editor will switch to insert mode to edit the file.
in main.cf add these settings
relayhost = [smtp.gmail.com]:587 smtp_tls_security_level = verify #smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt smtp_tls_session_cache_database = btree:/var/run/smtp_tls_session_cache smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_security_options = noanonymous
press : wq to exit vim. Go back to the sudo vi /etc/postfix/sasl_passwd shell type and enter the following (replace your gmail address and gmail password):
[smtp.gmail.com]:587 user@gmail.com :mypassword
press again : wq to save and exit the file and run the following command
sudo postmap /etc/postfix/sasl_passwd sudo postfix reload
Hope this helps someone with the same issue that I am facing.
Ibrahim Azhar Armar
source share