標籤:
在處理一個使用PHPMailer來發送電郵,我在本地使用我的163郵箱來做測試發送電郵,能夠成功的發送電郵;當上傳到正式平台時,出現了,類似這樣的錯誤資訊
SMTP ERROR: Password command failed: 535 Incorrect authentication data ,SMTP connect() failed.
在2015-03-03下午時,接近下班的時候,我在測試出現的,怎麼也發送不了郵件,當時我的PHPMailer的SMTPDebug是設定為1的。
到了2015-03-04上午上班時,我也不清楚該如何處理時,我就點擊PHPMailer的examples,在sublime text2點擊每個*.phps開啟預覽裡面的code,我在"examples/smtp.phps" 中看到SMTPDebug的注釋
//Enable SMTP debugging// 0 = off (for production use)// 1 = client messages// 2 = client and server messages$mail->SMTPDebug = 2;
對了,昨天我設定為1,只能看到"SMTP ERROR: Password command failed: 535 Incorrect authentication data"的訊息
將SMTPDebug設為2時,我可以看到debug訊息中,多了"We do not authorize the use of this system to transport unsolicited"這個訊息,大概的意思是:我們沒有委託本系統以外的未授權的服務來轉寄郵件。
所以我們可以嘗試使用我們伺服器上面的一個電郵帳號來發送電郵,具體的smtp的資料,需要你看自己伺服器(空間)的電郵(email)資料.我使用我們伺服器(空間)上面的一個我的電郵賬戶來發送郵件,可以發送成功了。
SMTP ERROR: Password command failed: 535 Incorrect authentication data