2016-09-12 80 views
-1

我想發送郵件作爲Outlook郵件...但它顯示連接錯誤和身份驗證錯誤,如果一些端口號被改變......我的代碼有什麼問題......我怎樣才能發送Outlook郵件使用PHP

$mail = new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPDebug = 2; 
$mail->CharSet = 'UTF-8'; 
$mail->SMTPAuth = true; 
$mail->SMTPSecure = "ssl"; 
$mail->Host  = "outlook.office365.com"; 
$mail->Port  = 993; 
$mail->Username = "[email protected]"; 
$mail->Password = "XXXXXXX"; 
$mail->From = $from; 
$mail->FromName= $FromName; 
$mail->isHTML(true); 
$mail->Subject = $subject; 
$mail->Body = $message; 
$mail->addAddress('[email protected]','harish'); 
if(!$mail->send()){ 
echo "Mailer Error: " . $mail->ErrorInfo; 
}else{ 
echo "E-Mail has been sent"; 
} 

它顯示這樣的錯誤......我做了什麼?

SERVER -> CLIENT: * OK The Microsoft Exchange IMAP4 service is ready. [SABLAE4AUABSADAANgBDAEEAMAAwADUAMwAuAGEAcABjAHAAcgBkADAANgAuAHAAcgBvAGQALgBvAHUAdABsAG8AbwBrAC4AYwBvAG0A] * BYE Connection is closed. 13 2016-09-12 10:50:13 SMTP NOTICE: EOF caught while checking if connected 2016-09-12 10:50:13 SMTP Error: Could not authenticate. 2016-09-12 10:50:13 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting

三江源....,

+2

所以它的工作原理,如果你離開的端口號保持不變?大。保持不變。 – Xorifelse

回答

0
+0

如果我更改端口號,它顯示像這樣2016-09-12 10:55:20 \t SMTP錯誤:無法連接到服務器:連接被拒絕(111)2016-09-12 10:55:20 \t SMTP連接() failed.Mailer錯誤:SMTP連接()失敗...請分享您的代碼.. –

+0

是否可以使用phpMailer發送Outlook郵件..?如果你有成功的消息,請分享示例代碼...!並有任何設置來更改godaddy發送Outlook郵件... –

相關問題