可以从Linux命令行发送邮件,但不能从PHP CLI发送邮件

I am running a dedicated CentOS 6.7 server for development. My MTA is Postfix.

I can send mail from the command line, e.g.

mail -s "Test email" myemail@myemaildomain1.com

The sending process shows up in /var/log/maillog, and the email arrives successfully.

If I try to send using PHP CLI, e.g.

php -a
php > mail('myemail@myemaildomain1.com', "Test email", "test email", 'From:myemail@myemaildomain2.com');

I get nothing. The PHP mail command returns TRUE, as if the process succeeded, but there is nothing in /var/log/maillog and no email ever arrives. There are no messages in any server log.

The relevant section of php.ini is standard, e.g.:

[mail function]
sendmail_path = /usr/sbin/sendmail -t -i

/usr/sbin/sendmail exists and is a symbolic link to /usr/sbin/sendmail.postfix.

If anyone can suggest possible solutions, it would be appreciated.