开发者

why does phpmailer class echo texts?

when i send email it echo many unnecessary texts, i don't want these text to be printed out. how can i disable these text.

example:

SMTP -> FROM SERVER:220 mx.google.com ESMTP p1sm1037082ybn.17
SMTP -> FROM SERVER: 250-mx.google.com at your service, [xxx.xxx.xxx.xxx] 250-SIZE 35651584 250-8BITMIME 250-AUTH LOGIN PLAIN XOAUTH 250 ENHANCEDSTATUSCODES
SMTP -> FROM SERVER:250 2.1.0 OK p1sm1037082ybn.17
SMTP -> FROM SERVER:250 2.1.5 OK p1sm1037082ybn.17
SMTP -> FROM SERVER:354 Go ahead p1sm1037082ybn.17
SMTP -> FROM SERVER:开发者_Python百科250 2.0.0 OK 1290167720 p1sm1037082ybn.17

i am using class.phpmailer.php file and using $obj.Send() method to send email. ??

thanks


PHPMailer has a "debug" flag that you can turn off.

Depending on which version you are using, it could be named Debug or SMTPDebug. You'll know it when you see it. If necessary, look into the class file to find out the name.

Set that to false and all is well.


As mention above it's the SMTPDebug option, just do:

$mail->SMTPDebug = 0;


By default it shouldn't generate any output. Make sure it is not wrapped in a print/echo statement/function.

A workaround could be using ob_start() at the beginning and ob_get_clean() at the end of your mailer script, so that it prevents any output from leaving the buffer.


If you are picking the whole config set from the example of the official PHPMailer github page, then just remove/comment out this line:-

 $mail->SMTPDebug = SMTP::DEBUG_SERVER;   
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜