[英]How to hide the logs of PHPMailer?
My code works but when I send an Email I see this long block on informations that starts like this:我的代码有效,但是当我发送 Email 时,我看到这个长块的信息是这样开始的:
2021-03-06 13:42:26 CLIENT -> SERVER: EHLO localhost 2021-03-06 13:42:26 客户端-> 服务器:EHLO 本地主机
2021-03-06 13:42:26 CLIENT -> SERVER: STARTTLS 2021-03-06 13:42:26 客户端-> 服务器:STARTTLS
2021-03-06 13:42:27 CLIENT -> SERVER: EHLO localhost 2021-03-06 13:42:27 客户端-> 服务器:EHLO 本地主机
2021-03-06 13:42:27 CLIENT -> SERVER: AUTH LOGIN 2021-03-06 13:42:27 客户端-> 服务器:授权登录
2021-03-06 13:42:27 CLIENT -> SERVER: [credentials hidden] 2021-03-06 13:42:27 客户端-> 服务器:[凭据隐藏]
2021-03-06 13:42:27 CLIENT -> SERVER: [credentials hidden] 2021-03-06 13:42:27 客户端-> 服务器:[凭据隐藏]
...and goes on writing al the informations about PHPMailer. ...并继续编写有关 PHPMailer 的所有信息。
I don't want everyone to see it after they send an Email, how can I hide it?发了Email后不想让大家看到,怎么隐藏?
that's my code:那是我的代码:
if($errore == 0){
$message_email = 'Messaggio inviato da: '.$name.' '.$surname.'<br>';
$message_email .= 'Email: '.$email.'<br>';
$message_email .= 'Telefono: '.$number.'<br>';
$message_email .= 'Oggetto: '.$object.'<br>';
$message_email .= 'Corpo: '.$message.'<br>';
require 'PHPMailer.php';
require 'Exception.php';
require 'SMTP.php';
$mail = new \PHPMailer\PHPMailer\PHPMailer();
$mail->IsSMTP();
$mail->Mailer = "smtp";
$mail->SMTPDebug = 1;
$mail->SMTPAuth = TRUE;
$mail->SMTPSecure = "tls";
$mail->Port = 587;
$mail->Host = "smtp.gmail.com";
$mail->Username = "myemail@gmail.com";
$mail->Password = "mypass";
$mail->IsHTML(true);
$mail->setFrom('bibibibi@gmail.com');
$mail->addAddress('lalala@gmail.com');
$mail->msgHtml($messaggio_email);
$mail->Subject = $object;
if(!$mail->Send()) {
echo "something went wrong";
var_dump($mail);
} else {
echo 'Email sent';
}
You need to change the "SMTP class debug output mode."您需要更改“SMTP class 调试 output 模式”。 using the SMTPDebug
property.使用SMTPDebug
属性。
$mail->SMTPDebug = SMTP::DEBUG_OFF;
Your actual value ( 1
) corresponding to DEBUG_CLIENT
.您的实际值 ( 1
) 对应于DEBUG_CLIENT
。
But you should use one of the following allowed values:但是您应该使用以下允许的值之一:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.