0
我想使用PHP郵件發送一些郵件,無聊的事情是,第一次發送一封電子郵件eas,我不知道我做了什麼讓這段代碼現在失敗。如何設置PHPMailer SMTP
錯誤:SMTP服務器錯誤:驗證所需
require("../mailer/class.phpmailer.php");
$mail = new PHPMailer();
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtpout.secureserver.net"; // SMTP server
$mail->From = "site email";
$mail->AddAddress("useremail");
$mail->Subject = "First PHPMailer Message";
$mail->Body = "Hi! \n\n This is my first e-mail sent through PHPMailer.";
$mail->WordWrap = 50;
if(!$mail->Send()) {
echo 'Message was not sent.';
echo 'Mailer error: ' . $mail->ErrorInfo;
}
else {
echo 'Message has been sent.';
}
我與GoDaddy託管。
檢查這個答案了。一般來說,你需要在使用SMTP時使用用戶名和密碼。如果你發送的第一封郵件正常工作,那麼可能是通過服務器上的'localhost' MTA? http://stackoverflow.com/questions/15087913/sending-email-from-form-through-gmail-smtp-on-godaddy – JakeGould