Home

About

Pictures

Projects

Blog

Work with Me

Posted: 27 May 2009

How to use the mail() php function to send mail.

This works and is REALLY easy! And can be undone later. It's just editing a text file. I know it's scary and advanced (I was scared and confused at first), but just do it. It's fine. And if it doesn't work, you can change it back. Simple! :)

Shutdown MAMP completely

Edit /etc/postfix/main.cf

Search for "relayhost"

Add relayhost = smtp.example.com

Start up MAMP again

smtp.example.com is an example smtp server. It's different depending on your internet provider. I'm at Harvard now, so mine is: smtp.fas.harvard.edu.

I'm not really sure why this works, but here's what I think it's doing: postfix is a mailserver that comes installed on your Mac (like php does). MAMP uses postfix to send emails. By setting up a relayhost, it tells postfix to send the emails from your current ISP because before it didn't know how to send the email and the email just got stuck in a queue.

So, now all those old emails should be in your inbox, or wherever you sent them to! :)

If you'd like to view your mail log, it should be here: /var/log/mail.log

FYI: I'm running Mac Leopard OS X 10.5.7 on one of the new MacBooks (with the silver titanium cover and black rim around the screen).

Source: http://mikeryan.name/books/knowledge-base/web-server-generated-email-under-mamp

Thanks to Mike for this! I didn't trust him at first because it seemed too easy, yet sophisticated, but it works!

05 Jun 2014 » Gratitude

06 May 2014 » Sexual Freedom for All

16 Mar 2014 » Learn to Code