我有一个流程,会在注册到我的网站后向用户发送带有确认链接的电子邮件。但邮件进入电子邮件的垃圾邮件文件夹。我尝试了许多来自互联网的代码,但似乎都没有。任何帮助将不胜感激。
这是我的代码:
/** Check Spam**/
$mailcheck = spamcheck($_POST['email']);
if ($mailcheck == FALSE) {
browse ("Invalid input");
}else{
$to = $email;
$subject = "Please Verify Your Email Address";
$header = "From: example@example.com";
$message.= "Please Click On The Link Below To Confirm Your Email Address With Us";
$message.=" ";
$message.= "www.mylink.com/subdomain/verification.php?user_verification=$code";
$sendmail = mail($to,$subject,$message,$header);
答案 0 :(得分:3)
添加MIME版本帮助我
$headers.= "MIME-version: 1.0\n";
$headers.= "Content-type: text/html; charset= iso-8859-1\n";
答案 1 :(得分:2)
此类代码可用于建立电子邮件提供商;
$exploded = explode('@', $To);
$exploded2 = explode('.', $exploded[1]);
switch (strtolower($exploded2[0]))
{
case 'hotmail': $Network = 'Microsoft'; break;
case 'outlook': $Network = 'Microsoft'; break;
case 'live': $Network = 'Microsoft'; break;
case 'gmail': $Network = 'Google'; break;
case 'googlemail': $Network = 'Google'; break;
case 'yahoo': $Network = 'Yahoo'; break;
case 'ymail': $Network = 'Yahoo'; break;
case 'rocketmail': $Network = 'Yahoo'; break;
case 'aol': $Network = 'AOL'; break;
case 'talktalk': $Network = 'TalkTalk'; break;
default: $Network = 'Other';
}