Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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:

  • http://blog.rajatpandit.com/2009/03/15/php-mail-and-osx-leopard/
  • http://theandystratton.com/2009/fix-phps-mail-function-after-latest-os-x-leopard-update
  • http://forums.oreilly.com/index.php?showtopic=5243&mode=threaded&pid=14721
  • http://jspr.tndy.me/2008/05/php-mail-and-osx-leopard/

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.

like image 900
paperclip Avatar asked Mar 15 '10 21:03

paperclip


1 Answers

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.

like image 79
Daniel Tedman Avatar answered Oct 05 '22 23:10

Daniel Tedman