移动到专用服务器 - 自动发送的电子邮件不发送?

时间:2013-07-22 20:39:28

标签: php email dns

我最近搬到了专用服务器。我更改了域名中的域名服务器,新网站现在运行得非常好。但是,自动电子邮件,例如新注册的确认电子邮件成员应该接收等,似乎没有发送。为什么会这样?

我知道可能存在各种各样的潜在原因,但如果有人有任何建议,听到它们会很棒!我使用Squirrel Mail检查了几个电子邮件帐户,在新的专用服务器上发送和接收似乎没问题。

提前感谢任何建议! : - )

1 个答案:

答案 0 :(得分:0)

停止将php mail()视为垃圾邮件

您必须添加针头:

示例代码:

$headers = "From: myplace@example.com\r\n";
$headers .= "Reply-To: myplace2@example.com\r\n";
$headers .= "Return-Path: myplace@example.com\r\n";
$headers .= "CC: sombodyelse@example.com\r\n";
$headers .= "BCC: hidden@example.com\r\n";

if ( mail($to,$subject,$message,$headers) ) {
   echo "The email has been sent!";
   } else {
   echo "The email has failed!";
   }
?> 
相关问题