我想设置一个PHP脚本,将发送电子邮件给选定的用户,我看了看互联网,发现如何,但不能运行脚本COS我得到以下错误:SMTP错误为PHP电子邮件
Warning: mail() [function.mail]: "sendmail_from" not set in php.ini or custom "From:" header missing in E:\Program Files\xampp\phpMyAdmin\emailer.php on line 10
下面是脚本的代码,我设计下面的例子:
<?php
$recipient = "<[email protected]>";
$subject = "Flight Status";
$body = "Flight has just landed.";
$host = "ssl://smtp.gmail.com";
$port = "465";
if(mail($recipient, $subject, $body))
{
echo("<p>Message successfully sent</p>");
}
else
{
echo("<p>Message Delivery failed </p>");
}
?>
在此先感谢。
你需要传递额外的头文件,因为错误是说你错过了从部分检查PHP邮件功能doc他们有头文件的例子 – 2011-06-02 15:47:47