简体   繁体   中英

How to test PHP mail() function on OSX Mavericks?

I had mail() function working locally before the update to OSX Mavericks. It seems like it's a common issue, but I haven't found any working solution so far.

PHP mail() returns true , but nothing is being sent. Please help.

I installed Postfix e-mail service for sending e-mail on my Mac. I'm running Mavericks (OS X 10.9.2) from web applications or command line, but had set this up on Mountain Lion originally. If I understand correctly, the sendmail binary will look for an available service to send through which is why you need Postfix running.

sudo mkdir -p /Library/Server/Mail/Data/spool
sudo /usr/sbin/postfix set-permissions
sudo /usr/sbin/postfix start

To test just run these commands.

sendmail user@domain.com 'my subject line'
type whatever you want to write

then press ctrl-d to send

I hope this helps.

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