2016-09-26 2 views
0

나는 PHPMailer를 통해 전자 메일을 보내려고합니다. 어떤 이유로 나는 인증이 실패한 것을 이해하지 못합니다.PHPMailer Exchange 인증

또한 TLS에 대한 인증 방법을 PLAIN 및 보안 방법으로 설정하는 등 여러 가지 방법을 시도했지만 도움이되지 않습니다.

우리 Exchange에는 DKIM을 사용하여 메일을 암호화하는 메일 서버로 메일을 보내는 스팸 프록시로 전자 메일을 보내는 송신 커넥터가 있습니다.

이 내 코드입니다 :

$mail = new PHPMailer(); 

     $mail->IsSMTP();          // set mailer to use SMTP 
     $mail->Host = $settings['mailserver']; // specify main and backup server 
     $mail->SMTPAuth = true;  // turn on SMTP authentication 
     $mail->Port = "25"; 
     $mail->Username = $settings['mail_domain']."\\".$settings['mail_username']; // SMTP username 
        echo $mail->Username; 
     $mail->Password = $settings['mail_password']; // SMTP password 
     $mail->SMTPOptions = array(
      'ssl' => array(
      'verify_peer' => false, 
      'verify_peer_name' => false, 
      'allow_self_signed' => true 
      ) 
     ); 

        $mail->SMTPDebug = 2; 

     $mail->From = $settings['mail_sender']; 
     $mail->AddAddress($emp_mail);   // name is optional 
     $mail->AddReplyTo($settings['mail_sender']); 

     $mail->WordWrap = 50;         // set word wrap to 50 characters 
     //$mail->AddAttachment("/var/tmp/file.tar.gz");   // add attachments 
     $mail->IsHTML(true);         // set email format to HTML 

     $mail->Subject = "Neue Datei erhalten: ".$filename." - ".$_COOKIE['settings']['firmenname']; 
     $mail->Body = $text; 
     $mail->AltBody = "Bitte laden Sie diese Email in der HTML Ansicht"; 

     if(!$mail->Send()) 
     { 
      $return_code['Code'] = 500; 
      $return_code['Msg'] = $mail->ErrorInfo.print_r($settings); 
     }else{ 
      $return_code['Code'] = "200"; 
     } 

그리고 이것은 내 대답입니다 :

2016-09-26 13:39:44 SERVER -> CLIENT: 220-cpanel-1.fr-hostings.at ESMTP Exim 4.87 #1 Mon, 26 Sep 2016 15:39:44 +0200 
             220-We do not authorize the use of this system to transport unsolicited, 
             220 and/or bulk e-mail. 
2016-09-26 13:39:44 CLIENT -> SERVER: EHLO transfer.feurich.com 
2016-09-26 13:39:44 SERVER -> CLIENT: 250-cpanel-1.fr-hostings.at Hello cpanel-1.fr-hostings.at [92.222.157.38] 
             250-SIZE 52428800 
             250-8BITMIME 
             250-PIPELINING 
             250-AUTH PLAIN LOGIN 
             250-STARTTLS 
             250 HELP 
2016-09-26 13:39:44 CLIENT -> SERVER: STARTTLS 
2016-09-26 13:39:44 SERVER -> CLIENT: 220 TLS go ahead 
2016-09-26 13:39:44 CLIENT -> SERVER: EHLO transfer.feurich.com 
2016-09-26 13:39:44 SERVER -> CLIENT: 250-cpanel-1.fr-hostings.at Hello cpanel-1.fr-hostings.at [92.222.157.38] 
             250-SIZE 52428800 
             250-8BITMIME 
             250-PIPELINING 
             250-AUTH PLAIN LOGIN 
             250 HELP 
2016-09-26 13:39:44 CLIENT -> SERVER: AUTH LOGIN 
2016-09-26 13:39:44 SERVER -> CLIENT: 334 VXNlcm5hbWU6 
2016-09-26 13:39:44 CLIENT -> SERVER: xxx= 
2016-09-26 13:39:46 SERVER -> CLIENT: 535 Incorrect authentication data 
2016-09-26 13:39:46 SMTP ERROR: Username command failed: 535 Incorrect authentication data 
2016-09-26 13:39:46 SMTP Error: Could not authenticate. 
2016-09-26 13:39:46 CLIENT -> SERVER: QUIT 
2016-09-26 13:39:46 SERVER -> CLIENT: 221 cpanel-1.fr-hostings.at closing connection 
2016-09-26 13:39:46 SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting 

어떤 아이디어?

+0

이것은 오류와 관련된 PHPMailer 문제 해결 안내서에서 다루고 있습니다 - 연결하려는 서버가 생각하는 서버인지 확인하십시오 입니다. 따라서 TLS 인증서 유효성 검사를 계속 유지하는 것이 중요합니다. TLS 인증서 유효성 검사는 이러한 상황을 감지하므로 켜십시오. – Synchro

답변

0

내가 조사한 결과, 이것이 실제로 cPanel 문제라는 것을 알게되었습니다. cPanel이 발신 SMTP 연결을 자체 로컬 메일 서버로 리디렉션하는 것 같습니다. 이 옵션은의 cPanel 루트 패널에서 집»서버 구성»비틀기 설정

에서 비활성화 할 수 있습니다. 저는 서버가 응답하는 것을 보았 기 때문에 그 점을 생각하지 않았습니다. 난 그저 자신의 웹 서버 메일 서버가 응답하지 않았다는 것을 인식하지 못했습니다.