douxuanpa8298 2018-04-24 09:25 采纳率: 0%
浏览 59

PHPMailer在某些情况下不起作用

I am sending mail with PHPmailer. The mail I send is working on Gmail. But it does not work in the account on mail.com. Does anyone know why? The result seems to be successful. But mail is not coming.

Example not working: developer@chef.net

Note: I'm using the same settings. My mail server on another server.

If the code I'm using is :

$mail = new PHPMailer(); // create a new object
$mail->IsSMTP(); // enable SMTP
$mail->SMTPAuth = true; // authentication enabled
$mail->SetLanguage("tr", "class/language");
$mail->CharSet    = "utf-8";
$mail->SMTPSecure = 'tls'; // secure transfer enabled REQUIRED for GMail
$mail->Host       = "example";
$mail->Port       = 25; // or 465
$mail->IsHTML(true);
$mail->SMTPOptions = array(
    'ssl' => array(
        'verify_peer' => false,
        'verify_peer_name' => false,
        'allow_self_signed' => true
    )
);
$mail->Username    = "example@example.com";
$mail->Password    = "example";
$mail->SetFrom($To[1], $To[0]);
$mail->Subject = 'example';

$mail->Body = 'example';
$mail->AddAddress($From[1], $From[0]);

if ($mail->Send()) {
    echo 'success';
} else {
    echo $mail->ErrorInfo;
}

I was also redirected to my server CloudFlare.

PHPMailer Logs Output:

2018-04-24 11:24:49 SERVER -> CLIENT: 220 centos.controlsunucu.com ESMTP Postfix
2018-04-24 11:24:49 CLIENT -> SERVER: EHLO oxyn.org
2018-04-24 11:24:49 SERVER -> CLIENT: 250-centos.controlsunucu.com
                                      250-PIPELINING
                                      250-SIZE 10240000
                                      250-ETRN
                                      250-STARTTLS
                                      250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
                                      250-ENHANCEDSTATUSCODES
                                      250-8BITMIME
                                      250 DSN
2018-04-24 11:24:49 CLIENT -> SERVER: STARTTLS
2018-04-24 11:24:49 SERVER -> CLIENT: 220 2.0.0 Ready to start TLS
2018-04-24 11:24:49 CLIENT -> SERVER: EHLO oxyn.org
2018-04-24 11:24:49 SERVER -> CLIENT: 250-centos.controlsunucu.com
                                      250-PIPELINING
                                      250-SIZE 10240000
                                      250-ETRN
                                      250-AUTH DIGEST-MD5 CRAM-MD5 PLAIN LOGIN
                                      250-ENHANCEDSTATUSCODES
                                      250-8BITMIME
                                      250 DSN
2018-04-24 11:24:49 CLIENT -> SERVER: AUTH CRAM-MD5
2018-04-24 11:24:49 SERVER -> CLIENT: 334 PDg0NDE4Mjc5NS4xNDYxOTU4NkBjZW50b3MuY29udHJvbHN1bnVjdS5jb20+
2018-04-24 11:24:49 CLIENT -> SERVER: aW5mb0BkaXN0aWxlaWNraS5jb20gYWQ1MmQ2YjZjZTkzZTE3OTMzZDU5ZGNmNzZmNTJlYWY=
2018-04-24 11:24:49 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2018-04-24 11:24:49 CLIENT -> SERVER: MAIL FROM:<apawebit@gmail.com>
2018-04-24 11:24:49 SERVER -> CLIENT: 250 2.1.0 Ok
2018-04-24 11:24:49 CLIENT -> SERVER: RCPT TO:<developer@chef.net>
2018-04-24 11:24:49 SERVER -> CLIENT: 250 2.1.5 Ok
2018-04-24 11:24:49 CLIENT -> SERVER: DATA
2018-04-24 11:24:49 SERVER -> CLIENT: 354 End data with <CR><LF>.<CR><LF>
2018-04-24 11:24:49 CLIENT -> SERVER: Date: Tue, 24 Apr 2018 14:24:49 +0300
2018-04-24 11:24:49 CLIENT -> SERVER: To: =?utf-8?Q?=C3=96zg=C3=BCr_Can_KARAG=C3=96Z?= <developer@chef.net>
2018-04-24 11:24:49 CLIENT -> SERVER: From: =?utf-8?Q?=C3=96zg=C3=BCr_Can_KARAG=C3=96Z?= <apawebit@gmail.com>
2018-04-24 11:24:49 CLIENT -> SERVER: Subject: Example
2018-04-24 11:24:49 CLIENT -> SERVER: Message-ID: <75ef49ca7263c41f42336be38def81f9@oxyn.org>
2018-04-24 11:24:49 CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer)
2018-04-24 11:24:49 CLIENT -> SERVER: MIME-Version: 1.0
2018-04-24 11:24:49 CLIENT -> SERVER: Content-Type: text/html; charset=utf-8
2018-04-24 11:24:49 CLIENT -> SERVER:
2018-04-24 11:24:49 CLIENT -> SERVER: Example
2018-04-24 11:24:49 CLIENT -> SERVER:
2018-04-24 11:24:49 CLIENT -> SERVER: .
2018-04-24 11:24:50 SERVER -> CLIENT: 250 2.0.0 Ok: queued as 918D133B8F
2018-04-24 11:24:50 CLIENT -> SERVER: QUIT
2018-04-24 11:24:50 SERVER -> CLIENT: 221 2.0.0 Bye
  • 写回答

1条回答 默认 最新

  • dongqu9972 2018-04-24 09:47
    关注

    1-change this sections

      $mail->SMTPSecure = 'tls'; 
      $mail->Host       = "example";
      $mail->Port       = 25;
      $mail->Username    = "example@example.com";
      $mail->Password    = "example";
    

    to =>>

      $mail->SMTPSecure = 'ssl'; 
      $mail->Host = 'smtp.gmail.com';
      $mail->Port       = 465;
      $mail->Username    = "your account in gmail";
      $mail->Password    = "your password account in gmail";
    

    2-and add this section:

      $mail->isHTML();
    
    评论

报告相同问题?