2016-11-23 9 views
0

PHPMailerに問題があります。私のウェブサイトIPで設定されたOffice 365サーバに接続したいのですが、私のIPアドレスは認証されていないため、認証なしで接続するためにOffice 365 SMTPサーバに接続できます。ホワイトリストに登録PHPMailerでOffice 365に接続する方法は?

問題は、サーバーに認証できないことです。

phpmailerの出力:

2016-11-23 09:06:50 CLIENT -> SERVER: EHLO www.thuis*******.nl 2016-11-23 09:06:50 SMTP Error: Could not authenticate. 2016-11-23 09:06:50 CLIENT -> SERVER: QUIT 2016-11-23 09:06:50 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting Mailer Error: SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

PHPファイル:

$mail = new PHPMailer(); 
$mail->IsSMTP(); 
$mail->SMTPDebug = 1; 
$mail->SMTPAuth = true; 
$mail->SMTPSecure = ''; 
$mail->SMTPAutoTLS = false; 
$mail->Host = "thuis*******-nl.mail.protection.outlook.com"; 
$mail->Port = 25; 
$mail->SetFrom('[email protected]*******.nl', 'John'); 
$mail->AddReplyTo("[email protected]*******.nl"); 
$mail->Subject = "This is the subject"; 
$mail->MsgHTML('Message body'); 
$address = "[email protected]"; 
$mail->AddAddress($address); 
if(!$mail->Send()) { 
    echo "Mailer Error: " . $mail->ErrorInfo; 
} else { 
    echo "Message sent!"; 
} 
+0

あなたのコードは古くなった例に基づいているので、最新バージョンを使用していることを確認してください。また、エラーメッセージがあなたを指しているドキュメントを読むと助けになります。 – Synchro

+0

@シンクロありがとう、私は解決策を見つけた、あなたはそれを下に読むことができます。 –

答えて

0

設定SMTPAuthfalseへ:

$mail->SMTPAuth = false; 

理由:私のサーバーは、任意の電子メールアカウントが設定されていません。

サーバのIPアドレスは、@thuis*******.nlのメールアドレスからメールを送信できるようにホワイトリストに登録されています。

関連する問題