我配置我的Amazon EC2实例与使用下列URL的sendmail发送邮件: http://docs.aws.amazon.com/ses/latest/DeveloperGuide/sendmail.html 结束后,我加入了php.ini中的以下行:无法发送邮件EC2-PHP和sendmail
sendmail_path =/usr/sbin/sendmail -t -i
我已经研究过其他解决方案,但他们没有帮助。 how to find out if PHP and sendmail are working together?
当我尝试从控制台发送电子邮件到达目的地。
须藤/ usr/sbin目录/ sendmail的[email protected] [email protected]
但是当我试图从代码中运行它,它不工作
<?php
$to = "[email protected]";
$subject = "Test mail";
$message = "Hello! This is a simple email message.";
$from ="[email protected]";
$headers = "From:" . $from;
$result = mail($to,$subject,$message,$headers);
if ($result)
{
echo "mail sent";
}
else
{
echo "error";
}
?>
结果总是如此,日志中没有任何东西。 有人可以帮助,我在这里做错了什么?
您是否想发送消息到'gmail.com.com'? – datasage
对不起,我编辑的问题,来源不包括.com.com –
结果返回true或false?你在/ var/log/maillog中看到与消息有关的任何东西吗?如果问题与发送或交付有关,则需要缩小范围。由于亚马逊IP位于垃圾邮件列表中,因此直接从EC2发送的邮件通常会被收件人过滤。 – datasage