我有一个表单可以从用户那里收到电子邮件,然后发送一封电子邮件给它,它在我的本地主机上正常运行但是当我将代码传输到我的服务器时( Biz.nf )我的用于发送电子邮件的PHP代码不再起作用。有什么建议我应该怎么让它再次运行?
$to = $_POST['EM']; // this is your Email address
$subject = "Recipt ";
$message = "The following is your receipt " .$FName. "\n This email was sent too prove that this functionality is working";
mail($to,$subject,$message);
答案 0 :(得分:0)
大多数主机处理电子邮件的方式略有不同,并且对有效的外发电子邮件应包含的内容有不同的看法。
邮件功能实际上有另一个参数,'标题'...请参阅documentation
由于缺少特定标头,您的主机很可能正在停止邮件。尝试下面的一些标题,看看有什么帮助。
$to = $_POST['EM']; // this is your Email address
$subject = "Recipt ";
$message = "The following is your receipt " .$FName. "\n This email was sent too prove that this functionality is working";
$headers = '';
$headers = $headers."From: outgoing@emailaddress.com"."\r\n";
$headers = $headers."Reply-To: replytomake@emailaddress.com"."\r\n";
$headers = $headers."Content-Type: text/html; charset=ISO-8859-1\r\n";
mail($to,$subject,$message,$headers);
注意:某些主机上的外发电子邮件地址必须是现有的。