Problems with PHPMailer and large emails

2

I have a problem sending an application email.

I've already tried PEAR_Mail in conjunction with PEAR_Mail_Mime and now with PHPMailer (which I found to be more readable).

What's happening?

When I send out an email alert (messages of generally 80 characters), the email is sent without problems. But when I was testing with an email of 1000 characters, the feedback I got is:

2014-06-17 14:35:06     Connection: opened
2014-06-17 14:35:06     SERVER -> CLIENT: 220 _____ ESMTP
2014-06-17 14:35:06     CLIENT -> SERVER: EHLO _____
2014-06-17 14:35:06     SERVER -> CLIENT: 250-_____
250-PIPELINING
250-8BITMIME
250-SIZE 31457280
250 AUTH LOGIN PLAIN
2014-06-17 14:35:06     CLIENT -> SERVER: AUTH LOGIN
2014-06-17 14:35:06     SERVER -> CLIENT: 334 ___
2014-06-17 14:35:06     CLIENT -> SERVER: (*      *)
2014-06-17 14:35:06     SERVER -> CLIENT: 334 ___
2014-06-17 14:35:06     CLIENT -> SERVER: (*      *)
2014-06-17 14:35:07     SERVER -> CLIENT: 235 ok, go ahead (#2.0.0)
2014-06-17 14:35:07     CLIENT -> SERVER: MAIL FROM:<_____>
2014-06-17 14:35:07     SERVER -> CLIENT: 250 ok
2014-06-17 14:35:07     CLIENT -> SERVER: RCPT TO:<_____>
2014-06-17 14:35:07     SERVER -> CLIENT: 250 ok
2014-06-17 14:35:07     CLIENT -> SERVER: DATA
2014-06-17 14:35:07     SERVER -> CLIENT: 354 go ahead
2014-06-17 14:35:07     CLIENT -> SERVER: Date: Tue, 17 Jun 2014 11:35:06 -0300
2014-06-17 14:35:07     CLIENT -> SERVER: To: ______
2014-06-17 14:35:07     CLIENT -> SERVER: From: ______
2014-06-17 14:35:07     CLIENT -> SERVER: Subject: =?iso-8859-1?Q?[______]_1_erro_|_Renova=E7=E3o_autom=E1tica?=
2014-06-17 14:35:07     CLIENT -> SERVER: Message-ID: <____@_______>
2014-06-17 14:35:07     CLIENT -> SERVER: X-Priority: 3
2014-06-17 14:35:07     CLIENT -> SERVER: X-Mailer: PHPMailer 5.2.8 (https://github.com/PHPMailer/PHPMailer/)
2014-06-17 14:35:07     CLIENT -> SERVER: MIME-Version: 1.0
2014-06-17 14:35:07     CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1
2014-06-17 14:35:07     CLIENT -> SERVER: Content-Transfer-Encoding: 8bit
2014-06-17 14:35:07     CLIENT -> SERVER:
2014-06-17 14:35:07     CLIENT -> SERVER: Segue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=
2014-06-17 14:35:07     CLIENT -> SERVER: =E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:=
2014-06-17 14:35:07     CLIENT -> SERVER: 35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da =
2014-06-17 14:35:07     CLIENT -> SERVER: renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-=
2014-06-17 14:35:07     CLIENT -> SERVER: 17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o l=
2014-06-17 14:35:07     CLIENT -> SERVER: og da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 20=
2014-06-17 14:35:07     CLIENT -> SERVER: 14-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASeg=
2014-06-17 14:35:07     CLIENT -> SERVER: ue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=
2014-06-17 14:35:07     CLIENT -> SERVER: =E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:=
2014-06-17 14:35:07     CLIENT -> SERVER: 06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da ren=
2014-06-17 14:35:07     CLIENT -> SERVER: ova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 =
2014-06-17 14:35:07     CLIENT -> SERVER: 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log =
2014-06-17 14:35:07     CLIENT -> SERVER: da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-=
2014-06-17 14:35:07     CLIENT -> SERVER: 06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue =
2014-06-17 14:35:07     CLIENT -> SERVER: o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o:=
2014-06-17 14:35:07     CLIENT -> SERVER:  2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0A=
2014-06-17 14:35:07     CLIENT -> SERVER: Segue o log da renova=E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=
2014-06-17 14:35:07     CLIENT -> SERVER: =E7=E3o: 2014-06-17 11:35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:=
2014-06-17 14:35:07     CLIENT -> SERVER: 35:06=0ASegue o log da renova=E7=E3o: 2014-06-17 11:35:06=0A=0AContrato: 22=
2014-06-17 14:35:07     CLIENT -> SERVER: 0760 - =DAltimo lancamento n=E3o encontrado
2014-06-17 14:35:07     CLIENT -> SERVER:
2014-06-17 14:35:07     CLIENT -> SERVER: .
2014-06-17 14:35:17     SERVER -> CLIENT:
2014-06-17 14:35:17     SMTP ERROR: DATA END command failed:
SMTP Error: data not accepted.
Message could not be sent.Mailer Error: SMTP Error: data not accepted.2014-06-17 14:35:17       CLIENT -> SERVER: QUIT
2014-06-17 14:35:27     SERVER -> CLIENT:
2014-06-17 14:35:27     SMTP ERROR: QUIT command failed:
2014-06-17 14:35:27     Connection: closed

Although the server specifies:

250-8BITMIME

I tried forcing base64, and I had the same problem.

The code I'm using to accomplish this request is:

    $mail = new PHPMailer();
    $mail->isSMTP();
    $mail->Host = $host;
    $mail->Port = $port;
    $mail->SMTPAuth = true;
    $mail->Username = $username;
    $mail->Password = $password;
    $mail->From = $username;
    $mail->FromName = "________";
    $mail->addAddress($to);

    $mail->isHTML(false);

    $mail->Subject = $this->_subject;
    //$mail->msgHTML($this->_htmlMessage); estou tentando inicialmente apenas com texto

    $mail->Body = $mail->encodeString($this->_txtMessage, 'quoted-printable');
    $mail->SMTPDebug = 3;

            //$mail->Encoding = '8bit'; //ja tentei deixar explicito, ja tentei base64
            //$mail->CharSet = 'utf8'; //ja tentei deixar sem, deixar utf8 e iso8859-1
    if (!$mail->send()){
        echo 'Message could not be sent.';
        echo 'Mailer Error: ' . $mail->ErrorInfo;
        return false;
    }else{
        return true;
    }

At the information level, this is the end of the return of a small email sent from the same code:

2014-06-17 14:47:03     CLIENT -> SERVER:
2014-06-17 14:47:03     CLIENT -> SERVER: .
2014-06-17 14:47:03     SERVER -> CLIENT: 250 ok 1403016424 qp 30696
2014-06-17 14:47:03     CLIENT -> SERVER: QUIT
2014-06-17 14:47:03     SERVER -> CLIENT: 221 ______
2014-06-17 14:47:03     Connection: closed
    
asked by anonymous 17.06.2014 / 16:45

2 answers

1

I was able to send large messages using: link

I have not yet fully verified what happened, and what it sends to the server. So the problem solution was to change from Pear_Mail / PHPMailer to swiftmailer .

Thank you all for the help.

    
18.06.2014 / 16:41
1

The $mail->Body with a minimally high amount in Kb fails and gives problems.

Try passing the message as follows:

$mail->MsgHTML($this->_txtMessage);

and / or also:

$mail->AltBody = $this->_txtMessage;

User Response Credentials @ user2270404 this answer in SOEN.

>     
17.06.2014 / 19:03