简体   繁体   中英

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:

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.

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.

Pasting in an answer from here: http://macosx.com/forums/unix-x11/19819-sendmail-not-working.html

Sounds like your problem based on the log entries you posted.

Additionally, the author of that post recommends that you'll have to do this again after a system update, so "repair permissions" is NOT what you want....and possibly the OPPOSITE of what you want.

The most common problem with sendmail on OS X is just a permission problem, and one which will show up after installing most packages from Software Update. Check /var/log/mail.log and see if it's complaining a lot about a group writable directory. If that's the case, then the problem is that the root directory is group writable. That's easily fixed with a quick "sudo chmod gx /". Then sendmail should be able to start properly, and I think it can be invoked by typing "/usr/sbin/sendmail -bd -q1h". Again, if all else fails, reboot.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM