我一直在尝试使用运行Postfix的Web服务器的Office365 SMTP中继。我需要能够将邮件从我的Office365域发送到域中的其他地址,所以我不认为端口25匿名SMTP将工作。Postfix sendmail从CL工作,但不是从PHP使用Office365
如果我运行
echo "testing" | sendmail [email protected] [email protected]
然后消息经过(条件是用户在sasl_passwd列出)
但是如果我运行一个简单的PHP脚本像这样:
<?php
$to = "[email protected]";
$subject = "Test";
$message = "test from PHP";
$from = "[email protected]";
$headers = "From:" . $from;
mail($to,$subject,$message,$headers);
echo "Mail Sent.";
?>
然后交货弹跳
550 5.7.1 Client does not have permissions to send as this sender
我已经读过,从= <>值的空值(我可以在日志中看到)是问题的原因,但我不知道如何将其更改为来自后缀设置的任何内容。如果命令行工作,我能正确理解postfix relay设置是否正确?有没有其他的PHP配置我缺少的步骤?
从查看日志文件看来,每次运行PHP脚本时都会生成两条消息。一个地址正确,另一个空。
让我知道你是否需要任何其他信息。提前致谢。
-Seth