PHP mail() no longer works after update to OSX Mountain Lion

前端 未结 2 1322
迷失自我
迷失自我 2021-01-30 03:05

I just updated OS X to Mountain Lion yesterday, but the php function mail() does not work anymore.

Before updating, the PHP mail() function wor

相关标签:
2条回答
  • 2021-01-30 03:59

    Finally I found the solution. After looking at the error_log (/Applications/XAMPP/xamppfiles/logs/error_log), there is an error: sendmail: fatal: chdir /Library/Server/Mail/Data/spool: No such file or directory

    Do the following at your terminal:

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

    Then the php mail() works!

    Reference: https://apple.stackexchange.com/questions/54051/sendmail-error-on-os-x-mountain-lion

    0 讨论(0)
  • 2021-01-30 04:07

    After creating the spool folder as described above, I configured postfix following the directions on this article OS X Hints

    I also had to edit my php.ini sendmail path to have some extra switches, specifically

    sendmail_path=/usr/sbin/sendmail -t -i
    
    0 讨论(0)
提交回复
热议问题