phpemailphpmailermailer

phpmailer prints long list of details (CLIENT -> SERVER) when sending email


I have got a script working with PHPMailer.

When i run it to send an email, the PHPMailer send the email successfully.

But ALSO echo long list of email sending information (CLIENT -> SERVER) like:

SERVER -> CLIENT: 220-server.mywebsitese.com ESMTP Exim 4.84 #2 Tue, 27 Jan 2015 08:37:57 +0200 220-We do not authorize the use of this system to transport unsolicited, 220 and/or bulk e-mail.
CLIENT -> SERVER: EHLO www.mywebsite.com
SERVER -> CLIENT: 250-server.mywebsite.com Hello server.mywebsite.com [xx.xxx.xx.xx]250-SIZE 52428800250-8B9uLITMIME250-PIPELINING250-AUTH PLAIN LOGIN250-STARTTLS250 HELP
CLIENT -> SERVER: AUTH LOGIN
SERVER -> CLIENT: 334 VXNlcm5h9uLbWU6
CLIENT -> SERVER: bm9yZXBseUBsZWJh9uLbm9uLWxvdHRvLmNvbQ==
SERVER -> CLIENT: 334 UGFzc39uLdvcmQ6
.
.
.
.Very
.
.
.Long
.
.
.List of SERVER -> CLIENT / CLIENT SERVER
.
Message sent!

The script activated by:

            if (!$mail->send()) {
            echo "Mailer Error: " . $mail->ErrorInfo;
            } else {
            echo "Message sent!";

What I really want is to only send the email, print MESSAGE SENT, no need of this long list..

Is this easily done?

Thanks


Solution

  • This seems to be debug information. Try to disable debugging by setting SMTPDebug to 0 right after you have created an instance of PHPMailer:

    $mail = new PHPMailer();
    $mail->SMTPDebug = 0;