2
I have a problem with sending emails from an application.
I’ve already tried PEAR_Mail
together with PEAR_Mail_Mime
and now with PHPMailer
(what I found most readable).
What is going on?
When I send an alert email (usually messages of about 80 characters) the email is sent without problems. But when I went to test it with a 1000-character email, the feedback I get 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 tested forcing Base64, and I had the same problem.
The code I’m using to perform 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 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
Test: http://swiftmailer.org
– chavesfop