PHP mail() using Sendmail on Mac OS X Leopard (10.5.8)

paperclip picture paperclip · Mar 15, 2010 · Viewed 15k times · Source

I've been struggling to get a really basic PHP function working on my iMac, the PHP mail() function.

I've used it countless times, albeit on a Windows platform and now I'm trying to get it running on Mac.

I've installed XAMPP v1.01 maybe because I didn't know any better at the time and I thought it would all just work fine, because that's what it's supposed to do. (Or so I thought).

I've tried the following pages of instructions to no avail:

To start with I did not have an entry for: MAILSERVER=-YES- in my /etc/hostconfig so I created it.

I added the full path to sendmail in my php.ini: sendmail_path = "/usr/sbin/sendmail -t -i"

I understand I don't need to set a myhostname variable in /etc/postfix/main.cf because I'm only planning on sending mail not receiving it. (NB. I've also tried it with this setting enabled!)

I've start postfix and then tried running the script but the script just processes with no error message, it just basically constantly looks as if it's working but nothing happens (I've triple checked the code for script).

I noticed some peoples solutions do not even mention having to start the postfix daemon for them to get the PHP mail() function to work.

Any ideas or things for me to try?

If you need more info, please ask.

P.

Answer

Daniel Tedman picture Daniel Tedman · Dec 5, 2011

XAMPP uses its own /etc folder, it is contained within the applications bundle. You right click and select show package contents. Now follow the guides you have listed but apply the changes to this /etc folder not the macs /etc folder.