Reputation: 1546
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:250 2.0.0 OK 1290167720 p1sm1037082ybn.17
i am using class.phpmailer.php file and using $obj.Send() method to send email. ??
thanks
Upvotes: 11
Views: 14464
Reputation: 370
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;
Upvotes: 2
Reputation: 14742
As mention above it's the SMTPDebug option, just do:
$mail->SMTPDebug = 0;
Upvotes: 10
Reputation: 449385
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.
Upvotes: 22
Reputation: 4749
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.
Upvotes: 7