2016-09-12 41 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邮件... –

相关问题