我想使用SMTP发送来自PHP的电子邮件,但每次我收到我的垃圾邮件中的电子邮件。我在谷歌搜索,并得到了一些解决方案,但我仍然收到垃圾邮件的电子邮件。你能帮我吗?使用SMTP和电子邮件从PHP发送电子邮件转到spam.What是最简单的方式发送电子邮件到收件箱?
//$mail->isSMTP(); // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com'; // Specify main and backup server
$mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = '[email protected]'; // SMTP username
$mail->Password = '***'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable encryption,'ssl' also accepted
$mail->Port = 587; //Set the SMTP port number - 587 for authenticated TLS
$mail->setFrom('[email protected]', 'admin'); //Set who the message is to be sent from
$mail->addReplyTo('[email protected]', 'First Last'); //Set an alternative reply-to address
$mail->addAddress($to, 'user'); // Add a recipient
$mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'Hello';
$mail->Body = "<html>
<head>
<title>HTML email</title>
</head>
<body>
<a href='/changepassword.php?user_id=" .$User_id1."'>Create your password here</a>
</body>
</html>";
if(!$mail->send()) {
echo 'Message could not be sent.';
echo 'Mailer Error: ' . $mail->ErrorInfo;
exit;
}
结帐:http://stackoverflow.com/questions/746809/prevent-sent-emails-treated-as-junk-mails-using-php-mail-function – Ajay
试图找到全球的IP地址黑名单。 – nagiyevel
谢谢答复Mr.Ajay。我也检查过,但仍然收到垃圾邮件。 –