PHP mail() ya no funciona después de la actualización a OSX Mountain Lion


Acabo de actualizar OS X a Mountain Lion ayer, pero la función php mail() ya no funciona.

Antes de actualizar, la función PHP mail() funcionaba bien, Apple mail funciona bien. Después de actualizar, Apple mail funciona bien, pero la función PHP mail() NO funciona.

Servidor web: XAMPP 1.7.3

Utilizo este código para probar la función mail():

if (mail($to, $object, $content, "From: ". $from)) 
{ 
    echo 'send '; 
} 
else 
{ 
    echo "not send"; 
}

Muestra: not send

¿Hay algo que tenga que cambiar? como el php.ini o algo más?

Gracias en avance.

Author: Globalfish, 2012-07-28

2 answers

Finalmente encontré la solución. Después de mirar el error_log (/Applications/XAMPP/xamppfiles/logs/error_log), hay un error: sendmail: fatal: chdir/Library/Server/Mail/Data / spool: No hay tal archivo o directorio

Haga lo siguiente en su terminal:

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

Entonces el php mail () funciona!

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

 79
Author: Globalfish,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2017-04-13 12:45:06

Después de crear la carpeta spool como se describió anteriormente, configuré postfix siguiendo las instrucciones de este artículo OS X Hints

También tuve que editar mi php.ini sendmail path para tener algunos switches adicionales, específicamente

sendmail_path=/usr/sbin/sendmail -t -i
 3
Author: Ryan,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/ajaxhispano.com/template/agent.layouts/content.php on line 61
2012-08-13 03:24:15