使用PHP发送电子邮件时,如何设置接收退回电子邮件的返回路径?
答案 0 :(得分:4)
mail()
中有一个参数允许用户设置其他标头。您应该设置一个“Return-Path”标题,如下所示:
mail($email, $subject, $message,
"From: $returnaddress\n"
. "Reply-To: $returnaddress\n"
. "Return-Path: $returnaddress");
答案 1 :(得分:3)
要在我的服务器上运行(bluehost),我还必须使用第五个参数(即“$ additional”),如下所示:
$headers = "From: joe.smith@shaw.ca\r\nReply-To: joe.smith@shaw.ca";
$additional = "-rjoe.smith@shaw.ca";
mail("fred.jones@shaw.ca", "Subject", "Message",$headers, $additional);