這是我的註冊郵件示例,它向用戶發送電子郵件以激活其帳戶。顯示爲垃圾郵件的PHP郵件()
//send activation email
$to = $email;
$subject = "Activate your account!";
$headers = "From: Example.com\r\n";
$headers .= "CC: $email\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Content-Type: text/html; charset=ISO-8859-1\r\n";
$server = "http://www.example.com";
ini_set("SMTP", $server);
$body = "<table style='border-top:1px solid #707070;border-bottom:1px solid #707070;margin-top:5px;'>";
$body .= "<tr><td colspan='2'><span style='font-family:arial;font-size:12px;color:#000000;'>Your login details are as follows; </span></td></tr>";
$body .= "<tr style='background-color:#f2f4f6;margin-bottom:5px;'><td>Username:</td><td>$username</td></tr>";
$body .= "<tr style='background-color:#f2f4f6;margin-bottom:5px;'><td>Password:</td><td>$password</td></tr></table>";
$body .= "<table><tr><td><span style='font-family:arial;font-size:12px;color:#000000;'>Follow the link:</span></td>";
$body .= "<td><a style='text-decoration:underline;font-family:arial;font-size:12px;color:#264971' href='http://www.example.com/activate.php?id=$lastid&code=$random'>http://www.example.com/activate.php?id=$lastid&code=$random</a></td>";
$body .= "</tr></table>";
$body .= "</body></html>";
//function to send email
if (mail($to, $subject, $body, $headers)) {}
當測試用戶註冊時,激活電子郵件結束在SPAM文件夾中。我必須改變以糾正此問題?
你做了最初的研究嗎? –
[爲什麼所有通過php的郵件發送的郵件轉到垃圾郵件框,但沒有直接從域的帳戶發送郵件?](http://stackoverflow.com/questions/2032286/why-are-all-mails - 通過phps郵件轉到垃圾郵箱 - 但不是郵件發送直接)和[PHP的郵件()直接發送到垃圾郵件框](http://stackoverflow.com/questions/) 2032552/php-mail-sending-straight-to-spam-box?rq = 1) – Leigh
沒有日期標題,從標題無效(域而不是電子郵件) – Gryphius