我有以下代码用于从我的网站发送电子邮件。迁移到 Godaddy.com 后,我的网站在需要时无法发送任何电子邮件。代码如下:
public function sendEmail($mailto, $from_mail, $from_name, $replyto, $subject, $message)
{
$uid = md5(uniqid(time()));
$header = "From: ".$from_name." <".$from_mail.">\r\n";
$header .= "Reply-To: ".$replyto."\r\n";
$header .= "MIME-Version: 1.0\r\n";
$header .= "Content-Type: multipart/mixed; boundary=\"".$uid."\"\r\n\r\n";
$header .= "This is a multi-part message in MIME format.\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-type:text/html; charset=utf-8\r\n";
$header .= "Content-Transfer-Encoding: 7bit\r\n\r\n";
$header .= $message."\r\n\r\n";
$header .= "--".$uid."\r\n";
$header .= "Content-Transfer-Encoding: base64\r\n";
$header .= "--".$uid."--";
/* line 124 */ return (mail($mailto, $subject, "", $header)) ? true : false; /* line
124 */
}
请注意,在更改托管服务器之前,我们的电子邮件没有任何问题。谢谢您的帮助