当触发我的邮件功能时,该邮件将转至“垃圾邮件”文件夹而不是“收件箱”。请问你能弄明白这个问题吗?
function send_user_email($mail, $to_email,$password, $first_name)
{
$html = "Hi $first_name, <br /><br />";
$html = $html . "<p> You have been registered with the system. Please find your login details below. </p>";
$html = $html . "User Name - $to_email <br />";
$html = $html . "Password - $password <br /> <br />";
$html = $html . "Regards, <br />";
$html = $html . "Team";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtpout.XXX.XXX.XXX"; // sets GMAIL as the SMTP server
// $mail->Host= "stmp.gmail.com"; // SMTP server
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Port = XXX; // set the SMTP port for the GMAIL server
$mail->Username = "mailid"; // GMAIL username
$mail->Password = 'password';// GMAIL password
$mail->From = "mailid";
$mail->FromName = "name";
$mail->Subject = "User invitation email";
$mail->AltBody = ""; // optional, comment out and test
$mail->IsHTML(true);
$mail->Body = nl2br($html);
$mail->AddAddress($to_email);
$mail->Send(); // send message
}
答案 0 :(得分:0)
您可以验证的事情很少:)
答案 1 :(得分:0)
通常情况下,如果电子邮件的“发件人:”标头值的域部分与实际发送电子邮件的域不匹配,则会将其标记为垃圾邮件。
绕过此问题的最简单方法是使用与您的域匹配的“发件人:”,并使用“回复:”标题添加到您在“发件人:”标题中设置的电子邮件
例如:如果您是从mydomain.com发送邮件而您的电子邮件是me@hotmail.com,则应将标题更改为:
From: me@mydomain.com
Reply-To: me@hotmail.com