为什么它不返回我的返回路径?
我正在使用 php,使用邮件功能:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$headers .= 'Reply-To: Admin <[email protected]>' . "\r\n";
// Return Path -
$return_path = "[email protected]";
$toUser... (all necessary variables)
if(mail($toUser,$subject,$body,$headers, "-f".$return_path)){
echo "res=sent";
} else {
echo "res=error";
}
我测试了一些电子邮件,例如 [电子邮件受保护]< /a>、[电子邮件受保护]
(等等,全部无效,非现有的电子邮件地址)
为什么它不发送到我的[电子邮件受保护]? ??
I am using php, using mail function:
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'From: [email protected]' . "\r\n";
$headers .= 'Reply-To: Admin <[email protected]>' . "\r\n";
// Return Path -
$return_path = "[email protected]";
$toUser... (all necessary variables)
if(mail($toUser,$subject,$body,$headers, "-f".$return_path)){
echo "res=sent";
} else {
echo "res=error";
}
I tested few emails like, [email protected], [email protected]
(etc, all invalid, non-existent email addresses)
Why it dont go to my [email protected]????
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您还应该能够在大多数服务器上使用标头设置返回路径:
You should also be able to set the Return-Path using a header on most servers:
您需要在
-f
后面添加一个空格。 另外,为什么不使用 UTF-8 而不是 iso-8859-1? 尝试这个:You need to add a space after
-f
. Also, why not use UTF-8 instead of iso-8859-1? Try this:可能是你的sendmail的配置导致的。 -F 参数作为命令行属性通过管道传递,因此需要配置 sendmail 来支持它。
来自 php.net:
编辑:我刚刚看到Matthias Bynens的答案是正确的,请参阅这个条目
It may be caused by the configuration of your sendmail. The -F parameter is piped through as a command line attribute, so sendmail needs to be configured to support it.
From php.net:
Edit: I just saw that Matthias Bynens' answer is correct, see this entry