我的公司已从本地网络服务器电子邮件更改为Office 365,现在不再收到电子邮件。 我正在尝试此配置,但无法正常工作
$mailer = new PHPMailer();
$mailer->IsSMTP();
$mailer->SMTPDebug = 3;
$mailer->Port = 587;
$mailer->Host = 'smtp.office365.com';
$mailer->SMTPAuth = true;
$mailer->Username = "xxxxxx";
$mailer->Password = "xxxxxx";
$mailer->SMTPOptions = array(
'ssl' => array(
'verify_peer' => false,
'verify_peer_name' => false,
'allow_self_signed' => true
)
);
$mailer->FromName = 'Bart S. Locaweb';
$mailer->From = 'remetente@email.com.br';
$mailer->AddAddress('destinatario@email.com','Nome do destinatário');
$mailer->Subject = 'Teste enviado através do PHP Mailer SMTPLW';
$mailer->Body = 'Este é um teste realizado com o PHP Mailer SMTPLW';
if(!$mailer->Send())
{
echo "Message was not sent";
echo "Mailer Error: " . $mailer->ErrorInfo; exit; }
print "E-mail enviado!";
}
我已经阅读了与该主题相关的几本书,第一件事是检查我是否与Office 365服务器连接...而且我已经
Testing smtp.gmail.com:587: successfull connected
Testing smtp.gmail.com:465: ERROR: 101 - Network is unreachable
Testing smtp.office365.com:587: successfull connected
所以我不明白为什么收到此通知
SMTP ERROR: Password command failed: 535 Incorrect authentication data
SMTP Error: Could not authenticate.
CLIENT -> SERVER: QUIT
SERVER -> CLIENT: 221 loge.dnsloge.com closing connection
Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
Message was not sentMailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
用户和通行证是正确的。...有帮助吗?
答案 0 :(得分:0)
步骤是与提供商联系以允许Office 365电子邮件
谢谢