I tried mail() to send emails in a php software, it showed:
Warning: mail() [function.mail]: “sendmail_from” not set in php.ini or custom “From:” header missing in in **.php on line *
I found two ways to settle this.
One is to set the parameters in php.ini like below:
[mail function]
SMTP = localhost
smtp_port = 25
sendmail_from = postmaster@localhost
I did so, but it didn’t work until I rebooted my notebook. I don’t know how to reboot php without rebooting the whole operation system.
If there are other problems, this article below may be helpful:
How to Configue Mercury Mail Transport System to Send External Mail
The other one is to put the following at the top of the script:
ini_set (“SMTP”,”localhost”);
ini_set (“sendmail_from”,”from-email@yourdomain.com”);
mail(‘to-email@yourdomain.com’, ‘Mercury test mail’, ‘If you can see this, everything is fine!’);
Here, to-email@yourdomain.com is destination E-mail, and from-email@yourdomain.com will indicate where the email is from in the destination E-mail box.