在我的ec2实例上使用sendmail配置了Amazon SES,如文档中所述http://docs.aws.amazon.com/ses/latest/DeveloperGuide/scripts-mtas-sendmail.html
能够使用下面的行成功发送邮件,并且我将电子邮件发送到我的gmail收件箱,
sudo /usr/bin/sendmail -f from@example.com myemail@gmail.com
现在-当我从PHP使用
发送邮件mail($to, $subject, $message, $headers);
我收到的是垃圾邮件文件夹。
您是否在$headers
参数中定义了From
地址?
PHP的mail
函数,不接受一个指定的$from
参数来标记发送者的地址。
相反,您应该使用$headers
参数来配置from地址。参见示例#2:http://www.php.net/manual/en/function.mail.php
使用like
mail($to, $subject, $message, $headers,'-abc@domain.com');
如果仍然面临同样的问题,请检查您的$headers