Skip to main content
adicionado informação de testes
Fonte Link
chavesfop
  • 302
  • 1
  • 10

Apesar do servidor especificar:

250-8BITMIME

Testei forçando base64, e tive o mesmo problema.

    $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;
    }
$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;
    }

Apesar do servidor especificar:

250-8BITMIME

Testei forçando base64, e tive o mesmo problema.

    $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;
    }
removeu 46 caracteres do conteúdo
Fonte Link
chavesfop
  • 302
  • 1
  • 10
Fonte Link
chavesfop
  • 302
  • 1
  • 10

Problemas com PHPMailer e e-mails grandes

Estou com um problema com o envio de e-mails de uma aplicação.

Eu já tentei PEAR_Mail em conjunto com PEAR_Mail_Mime e agora com PHPMailer (o que achei mais legível).

O que esta ocorrendo?

Quando eu envio e-mail de alerta (mensagens geralmente de uns 80 caracteres) o e-mail é enviado sem problemas. Porém quando fui testar com um e-mail de 1000 caracteres, o retorno que tenho é:

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

O código que estou utilizando para realizar essa request é:

$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;
    }

A nível de informação, este é o final do retorno de um e-mail pequeno enviado do mesmo código:

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