Mailcatcher: PHP mail() function returns false
email, mailcatcher, php
Solution
I faced the same problem on ubuntu 14.04.
`/etc/php5/cli/php.ini` and `/etc/php5/fpm/php.ini` had the same `sendmail_path` configuration but only `php-cli` could send emails.
For my environment, `Mailcatcher` works on a distant server and I use the `catchmail` command to contact it.
Here is the `sendmail_path` I used:
sendmail_path = /usr/bin/env catchmail --smtp-ip mailcatcher-ip -f address@example.com
For the `fpm` `php.ini` file, I had to specify the full path to `catchmail` for the mail function to work correctly:
sendmail_path = /usr/bin/env /usr/local/bin/catchmail --smtp-ip mailcatcher -f address@example.com
Problem
i will try to describe my problem: to debug outgoing email in local environment i installed mailcatcher (http://mailcatcher.me/) but faced some problems with catching mails sent from web. if i run the script which contains only one mail() call, everything is fine and i can see the sent email in mailcatcher 127.0.0.1:1080. But when i try to access the same script from the web browser, the mail() function returns false, no any error displayed in browser, nothing in error logs. In mail log even i can see the call for mail() function. i am not sure, may be my nginx/php-fpm configuration is wrong, or something wrong with permissions. selinux is disabled. please help if you know the solution. Thanks in advance