Question

actually if I run the mail function in the php console (php -a) it works, but if i do it on a php script and I execute it from chrome it doesnt work.

<?php
   mail('test@gmail.com', 'Subject', 'Hello!');
?>

Im using Nginx with PHP-FPM and ssmtp SMTP server.

Note: Investigating, the problem is on Nginx or FPM, when i run the script from terminal it works.

Thanks!

Was it helpful?

Solution

Are you using php-fpm in chrooted mode?

If so chances are that a lot of system mail() requirements aren't available to your chrooted envirronment.

usually such chroot external programs problems can be solved by creating a faxed filesystem in the chrooted path (devices, libraries). But for mail it's harder. The usual solution is not using the php mail call but using instead an smtp communication (with localhost for example). Some examples are listed here.

OTHER TIPS

Have you tried to install PEAR and using the PEAR mail?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top