2017-09-08 16 views
0

にログインすることができませんでしたが、私は、私はから送信しようとしていたコードがは、Office 365とphpmailerの私は電子メールがOffice 365の通過です送信するためにPHPを設定しようとしています

<?php 
require_once("PHPMailer/PHPMailerAutoload.php"); 

$emailLogin="[email protected]"; //Username and Password work from web 
$emailPassword='MyPassword'; 

$mail = new PHPMailer(true); 
$mail->isSMTP(); 
$mail->Host = 'smtp.office365.com'; 
$mail->Port  = 587; 
$mail->SMTPSecure = 'tls'; 
$mail->SMTPAuth = true; 
$mail->Username = $emailLogin; 
$mail->Password = $emailPassword; 
$mail->SetFrom($emailLogin, 'FromEmail'); 
$mail->addAddress('[email protected]', 'ToEmail'); 
$mail->SMTPDebug = 3; 
//$mail->Debugoutput = function($str, $level) {echo "debug level $level; message: $str";}; //$mail->Debugoutput = 'echo'; 
$mail->IsHTML(true); 

$mail->Subject = 'Here is the subject'; 
$mail->Body = 'This is the HTML message body <b>in bold!</b>'; 
$mail->AltBody = 'This is the body in plain text for non-HTML mail clients'; 

if(!$mail->send()) { 
    echo 'Message could not be sent.'; 
    echo 'Mailer Error: ' . $mail->ErrorInfo; 
} else { 
    echo 'Message has been sent'; 
} 
?> 
ある

17-09-08 16:43:00 CLIENT -> SERVER: AUTH LOGIN 2017-09-08 16:43:00 SERVER -> CLIENT: 334 XXREMOVEDXX 2017-09-08 16:43:00 CLIENT 
-> SERVER: 334 XXREMOVEDXX 2017-09-08 16:43:00 SERVER -> CLIENT: 334 XXREMOVEDXX 2017-09-08 16:43:00 CLIENT -> SERVER: 334 XXREMOVEDXX 2017-09-08 16:43:06 SERVER -> CLIENT: 535 5.7.3 Authentication unsuccessful [MWHPR11CA0014.namprd11.prod.outlook.com] 2017-09-08 16:43:06 SMTP ERROR: Password command failed: 535 5.7.3 Authentication unsuccessful [MWHPR11CA0014.namprd11.prod.outlook.com] 2017-09-08 16:43:06 SMTP Error: Could not authenticate. 2017-09-08 16:43:06 CLIENT -> SERVER: QUIT 2017-09-08 16:43:06 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel 2017-09-08 16:43:06 Connection: closed 2017-09-08 16:43:06 SMTP Error: Could not authenticate. PHP Fatal error: Uncaught exception 'phpmailerException' with message 'SMTP Error: Could not authenticate.' in /PHPMailer/class.phpmailer.php:1697 Stack trace: 
#0 /fast/home/tholum/mailtest/PHPMailer/class.phpmailer.php(1540): PHPMailer->smtpConnect(Array) 
#1 /fast/home/tholum/mailtest/PHPMailer/class.phpmailer.php(1335): PHPMailer->smtpSend('Date: Fri, 8 Se...', 'This is a multi...') 
#2 /fast/home/tholum/mailtest/PHPMailer/class.phpmailer.php(1213): PHPMailer->postSend() 
#3 /fast/home/tholum/mailtest/test2.php(25): PHPMailer->send() 
#4 {main} 

認証エラーを取得します

すべてのヘルプは大プレーンテキスト用としてパスワードを強制的に

+0

誰もあなたのためにあなたのコードをデバッグするつもりはありません。 Office365 APIがこのように平文パスワードの認証を許可していますか? APIのドキュメントでどのように推奨するかを確認し、ドキュメントに関するパスワードのエラーコードを確認してください。 – jdv

+0

SMTPのトランスクリプト(暗号化されたパスワードを差し引いたもの)を除いてはわかりません。 – Synchro

+0

スタックオーバーフローはありません投稿の(コードの%の高い) https://pastebin.com/0JXfv4Ks –

答えて

関連する問題