【问题标题】:sending email using phpmailer returns a chunk of data使用 phpmailer 发送电子邮件会返回一大块数据
【发布时间】:2017-02-14 16:45:12
【问题描述】:

我尝试使用 phpmailer 发送电子邮件,但在发送电子邮件后,即使邮件已成功发送,我也会收到大量数据,谁能帮助我知道为什么会发生这种情况以及我如何才能停止看到此消息

这是我为发送邮件所做的

$mail = new PHPMailer;

$mail->SMTPDebug = 3;                                      // Enable verbose debug output

$mail->isSMTP();   
$mail->SMTPDebug = 1;                                    // Set mailer to use SMTP
$mail->Host = 'smtp.gmail.com';                         // Specify main and backup SMTP servers
$mail->SMTPAuth = true;                                // Enable SMTP authentication
$mail->Username = 'myemail@gmail.com';         // SMTP username
$mail->Password = 'myphonenumber';                      // SMTP password
$mail->SMTPSecure = 'tls';                          // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;  
$mail->SetFrom('example@testrun.com','yahoo');
$mail->addAddress('example@test.com', 'User'); // Add a recipient
$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';
}

发送电子邮件后我得到的是

2017-02-14 16:34:18 CLIENT -> SERVER: EHLO localhost
2017-02-14 16:34:19 CLIENT -> SERVER: STARTTLS 2017-02-14 16:34:19  
CLIENT -     > SERVER: EHLO localhost 2017-02-14 16:34:19   
CLIENT -> SERVER: AUTH LOGIN 
2017-02-14 16:34:20 CLIENT -> SERVER: c2hhaGlka2hhbjAyMTFAZ21haWwuY29t 2017-    02-14 16:34:20
CLIENT -> SERVER: NzczNjEyNzQ5OA== 2017-02-14 16:34:21  CLIENT -> SERVER: MAIL FROM: 2017-02-14 16:34:21 
CLIENT -> SERVER: RCPT TO: 2017-02-14 16:34:21  CLIENT -> SERVER: DATA 2017-02-14 16:34:22  
CLIENT -> SERVER: Date: Tue, 14 Feb 2017 16:34:18 +0000 2017-02-14 16:34:22      CLIENT -> SERVER: To: User 2017-02-14 
16:34:22    CLIENT -> SERVER: From: yahoo 2017-02-14 16:34:22   CLIENT -> SERVER: Subject:
 Subject: Here is the subject 2017-02-14 16:34:22   CLIENT -> SERVER: Message-ID: <612e33637d0c6d82ec72f3a70bc1b79c@localhost> 2017-02-14 
16:34:22    CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.22 (https://github.com/PHPMailer/PHPMailer) 2017-02-14 16:34:22
CLIENT -> SERVER: MIME-Version: 1.0 2017-02-14 16:34:22 CLIENT -> SERVER:  Content-Type: multipart/alternative; 2017-02-14 16:34:22 
CLIENT -> SERVER: boundary=
"b1_612e33637d0c6d82ec72f3a70bc1b79c" 2017-02-116:34:2
CLIENT -> SERVER: Content-Transfer-Encoding: 8bit 2017-02-14 16:34:22           CLIENT -> SERVER: 2017-02-14 16:34:23   
CLIENT -> SERVER: QUIT Message has been sent

【问题讨论】:

    标签: php email phpmailer


    【解决方案1】:

    删除这一行:

    $mail->SMTPDebug = 1;    
    

    或将值更改为 0 或 3

    • 0 = 没有
    • 1 = 错误和消息
    • 2 = 仅消息
    • 3 = 没有

    【讨论】:

    • 不客气,下次检查谷歌...它就在那里;)
    【解决方案2】:

    改变

    $mail->SMTPDebug = 3;
    

    $mail->SMTPDebug = 0;
    

    【讨论】:

    • 嘿,没问题,去过那里,得到了这个社区的帮助。 Mart 的回答是一个很好的解释,所以标记为已接受...
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-10-27
    • 1970-01-01
    • 1970-01-01
    • 2014-06-26
    • 1970-01-01
    相关资源
    最近更新 更多