配置PHPMailer以使用交换

时间:2017-10-25 08:17:23

标签: php phpmailer exchange-server

我在几个月内在客户服务器上使用phpmailer,但是"邮件提供商"改变了它的服务器使用Exchange,因为phpmailer停止工作,我尝试了几个参数,但它永远不会工作。

我的实际配置:

    $mail = new PHPMailer(true);
    $mail->IsSMTP();
    $mail->SMTPDebug=4;
    $mail->CharSet = "UTF-8";
    $mail->Timeout = 10;
    $mail->IsHTML(true);
    $mail->Host='smtp.fingerprint.fr';
    $mail->Port = 465; 
    $mail->Username = 'username';
    $mail->Password = 'password';
    $mail->SMTPAuth = true; 
    $mail->AuthType = 'LOGIN';
    $mail->SMTPSecure = 'ssl';

    $mail->SMTPOptions = array (
        'ssl' => array(
                        'verify_peer'  => false,
                        'verify_peer_name'  => false,
                        'allow_self_signed' => true));

    $mail->Priority = 3;

    $mail->setFrom('some@mail', 'name');
    $mail->AddAddress($email); // destinataire

    $mail->Subject=$objet;
    $mail->Body=$message;
    $mail->WordWrap = 50;

    $mail->send();

    $mail->SmtpClose();

使用端口465,几秒钟后我得到:

2017-10-25 08:11:18 Connection: opening to ssl://smtp.fingerprint.fr:465, timeout=10, options=array (
                                        'ssl' => 
                                        array (
                                          'verify_peer' => false,
                                          'verify_peer_name' => false,
                                          'allow_self_signed' => true,
                                        ),
                                      )
2017-10-25 08:11:19 Connection: opened
2017-10-25 08:11:19 SMTP -> get_lines(): $data is ""
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "220 mxr1.fingerprint.fr ESMTP
                                      "
2017-10-25 08:11:19 SERVER -> CLIENT: 220 mxr1.fingerprint.fr ESMTP
2017-10-25 08:11:19 CLIENT -> SERVER: EHLO domain.tld
2017-10-25 08:11:19 SMTP -> get_lines(): $data is ""
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "250-mxr1.fingerprint.fr
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "250-AUTH LOGIN CRAM-MD5 PLAIN
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr
                                      250-AUTH LOGIN CRAM-MD5 PLAIN
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "250-AUTH=LOGIN CRAM-MD5 PLAIN
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr
                                      250-AUTH LOGIN CRAM-MD5 PLAIN
                                      250-AUTH=LOGIN CRAM-MD5 PLAIN
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "250-PIPELINING
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr
                                      250-AUTH LOGIN CRAM-MD5 PLAIN
                                      250-AUTH=LOGIN CRAM-MD5 PLAIN
                                      250-PIPELINING
                                      "
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "250 8BITMIME
                                      "
2017-10-25 08:11:19 SERVER -> CLIENT: 250-mxr1.fingerprint.fr
                                      250-AUTH LOGIN CRAM-MD5 PLAIN
                                      250-AUTH=LOGIN CRAM-MD5 PLAIN
                                      250-PIPELINING
                                      250 8BITMIME
2017-10-25 08:11:19 Auth method requested: LOGIN
2017-10-25 08:11:19 Auth methods available on the server: LOGIN,CRAM-MD5,PLAIN
2017-10-25 08:11:19 CLIENT -> SERVER: AUTH LOGIN
2017-10-25 08:11:19 SMTP -> get_lines(): $data is ""
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "334 Vqsdfg5fgqU6
                                      "
2017-10-25 08:11:19 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2017-10-25 08:11:19 CLIENT -> SERVER: xxx
2017-10-25 08:11:19 SMTP -> get_lines(): $data is ""
2017-10-25 08:11:19 SMTP -> get_lines(): $str is  "334 Uqgsh3dvcmQ6
                                      "
2017-10-25 08:11:19 SERVER -> CLIENT: 334 x32d13f1321
2017-10-25 08:11:19 CLIENT -> SERVER: xxx=
2017-10-25 08:11:29 SMTP -> get_lines(): $data is ""
2017-10-25 08:11:29 SMTP -> get_lines(): $str is  ""
2017-10-25 08:11:29 SMTP -> get_lines(): timed-out (10 sec)
2017-10-25 08:11:29 SERVER -> CLIENT:
2017-10-25 08:11:29 SMTP ERROR: Password command failed:
2017-10-25 08:11:29 SMTP Error: Could not authenticate.
2017-10-25 08:11:29 CLIENT -> SERVER: QUIT
2017-10-25 08:11:29 SMTP -> get_lines(): $data is ""
2017-10-25 08:11:29 SMTP -> get_lines(): $str is  "535 authorization failed (#5.7.0)
                                      "
2017-10-25 08:11:29 SERVER -> CLIENT: 535 authorization failed (#5.7.0)
2017-10-25 08:11:29 SMTP ERROR: QUIT command failed: 535 authorization failed (#5.7.0)
2017-10-25 08:11:29 Connection: closed
2017-10-25 08:11:29 SMTP Error: Could not authenticate.

使用端口587,TLS

Connection: opening to smtp.fingerprint.fr:587, timeout=10, options=array ()
Connection: opened
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "220 mxr1.fingerprint.fr ESMTP"
SERVER -> CLIENT: 220 mxr1.fingerprint.fr ESMTP
CLIENT -> SERVER: EHLO creforma.fr
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "250-mxr1.fingerprint.fr"
SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr"
SMTP -> get_lines(): $str is "250-AUTH LOGIN CRAM-MD5 PLAIN"
SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr250-AUTH LOGIN CRAM-MD5 PLAIN"
SMTP -> get_lines(): $str is "250-AUTH=LOGIN CRAM-MD5 PLAIN"
SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr250-AUTH LOGIN CRAM-MD5 PLAIN250-AUTH=LOGIN CRAM-MD5 PLAIN"
SMTP -> get_lines(): $str is "250-PIPELINING"
SMTP -> get_lines(): $data is "250-mxr1.fingerprint.fr250-AUTH LOGIN CRAM-MD5 PLAIN250-AUTH=LOGIN CRAM-MD5 PLAIN250-PIPELINING"
SMTP -> get_lines(): $str is "250 8BITMIME"
SERVER -> CLIENT: 250-mxr1.fingerprint.fr250-AUTH LOGIN CRAM-MD5 PLAIN250-AUTH=LOGIN CRAM-MD5 PLAIN250-PIPELINING250 8BITMIME
CLIENT -> SERVER: STARTTLS
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "502 unimplemented (#5.5.1)"
SERVER -> CLIENT: 502 unimplemented (#5.5.1)
SMTP ERROR: STARTTLS command failed: 502 unimplemented (#5.5.1)
SMTP Error: Could not connect to SMTP host.
CLIENT -> SERVER: QUIT
SMTP -> get_lines(): $data is ""
SMTP -> get_lines(): $str is "221 mxr1.fingerprint.fr"
SERVER -> CLIENT: 221 mxr1.fingerprint.fr
Connection: closed
SMTP Error: Could not connect to SMTP host.

有人可以帮忙吗? 感谢

0 个答案:

没有答案