我试图使用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 = 'shahidkhan0211@gmail.com'; // SMTP username
$mail->Password = '7736127498'; // SMTP password
$mail->SMTPSecure = 'tls'; // Enable TLS encryption, `ssl` also accepted
$mail->Port = 587;
$mail->SetFrom('sree@yahoo.com','yahoo');
$mail->addAddress('shahidkhan021@rocketmail.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
答案 0 :(得分:2)
删除此行:
$mail->SMTPDebug = 1;
或将值更改为0或3
答案 1 :(得分:2)
更改
$mail->SMTPDebug = 3;
到
$mail->SMTPDebug = 0;