我正在嘗試使用phpMailer和GMail SMTP發送電子郵件。它很好地發送電子郵件到其他Gmail帳戶,但發送到雅虎的郵件永遠不會到達那裏。我讀過關於使用IP地址等進行調試,但我不擅長這方面的技術?PHPMailer Lite&GMAIL SMTP:電子郵件未發送至Yahoo Mail,如何調試?
這裏是代碼:
$mail->Mailer='smtp';
try {
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "tls"; // sets the prefix to the servier
$mail->Host = "smtp.gmail.com"; // sets GMAIL as the SMTP server
$mail->Port = 587; // set the SMTP port for the GMAIL server
$mail->Username = "__email__"; // GMAIL username
$mail->Password = "__pass__"; // GMAIL password
$mail->SMTPDebug = 2;
$a = md5(uniqid(rand(), true)); //create a unique validation code
//These are the variables for the email
$mail->AddAddress (trim($_POST['email']),trim($_POST['username'])); // this is the email address collected form the form
$mail->Subject = "Registration"; // Subject
$mail->Body = "Thank you for registering\n your security code is ".$a;
$mail->Send();
echo "check your email to complete registration";
} catch (phpmailerException $e) {
echo $e->errorMessage(); //Pretty error messages from PHPMailer
} catch (Exception $e) {
echo $e->getMessage(); //Boring error messages from anything else!
}
$mail->ClearAddresses();
更新:發現了問題:我們的服務器已經被雅虎(不是我的錯) 列入黑名單,所以這是一個浪費一天和半。
你確定郵件不被逮住的垃圾郵件過濾器,你可以檢查 – 2010-12-15 02:33:39
我查耶第一件事情沒有任何地方的郵件沒有 – JIStone 2010-12-15 02:34:35