我想发送邮件作为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
三江源....,
所以它的工作原理,如果你离开的端口号保持不变?大。保持不变。 – Xorifelse