CodeIgniter Forums

Full Version: SMTP error with Sparkpost
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi there,
I use the email library to send mail using SMTP.
I was using Mandrill, and all was working fine.
I now use Sparkpost, and I have irregular error. CI Library returns blank error once in a while. The exact same mail can work ten times and fail one.
My config :
PHP Code:
$config['protocol'] = 'smtp';
$config['smtp_host'] = 'smtp.sparkpostmail.com';
$config['smtp_user'] = '****';
$config['smtp_pass'] = '****';
$config['smtp_port'] = '587';
$config['smtp_crypto'] = 'tls';
$config['crlf'] = "\r\n";
$config['newline'] = "\r\n";
$config['useragent'] = "BioCRM";
$config['wordwrap'] = FALSE;
$config['mailtype'] = "html";
$this->email->initialize($config); 

Here are examples of errors I get with print_debugger()
Quote:Example 1:
---------
hello:
The following SMTP error was encountered:
starttls: 220 2.0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.21.55447 r(Core:4.2.21.2) Thu, 09 Jun 2016 05:46:19 +0000
The following SMTP error was encountered:
Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.
--------

Example 2:
--------
hello: 220 2.0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.21.55447 r(Core:4.2.21.2) Wed, 08 Jun 2016 14:08:44 +0000
The following SMTP error was encountered: 220 2.0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.21.55447 r(Core:4.2.21.2) Wed, 08 Jun 2016 14:08:44 +0000

starttls: 250-momentum4.platform1.us-west-2.aws.cl.messagesystems.com says EHLO to 89.31.151.18:39185
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-AUTH=LOGIN PLAIN
250-AUTH LOGIN PLAIN
250-PIPELINING
250 STARTTLS
The following SMTP error was encountered: 250-momentum4.platform1.us-west-2.aws.cl.messagesystems.com says EHLO to 89.31.151.18:39185
250-ENHANCEDSTATUSCODES
250-8BITMIME
250-AUTH=LOGIN PLAIN
250-AUTH LOGIN PLAIN
250-PIPELINING
250 STARTTLS
The following SMTP error was encountered: .0.0 continue
--------

Example 3:
--------
hello:
L'erreur SMTP suivante s'est produite :
starttls:
L'erreur SMTP suivante s'est produite :
L'erreur SMTP suivante s'est produite : .0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.21.55447 r(Core:4.2.21.2) Wed, 08 Jun 2016 12:59:08 +0000
---------

As I get those errors only with Sparkpost, I asked them, and here is their answer :
Quote:The errors you’ve pasted are regular parts of the SMTP conversion. For example 1:

“starttls: 220 2.0.0 smtp.sparkpostmail.com ESMTP ecelerity 4.2.21.55447 r(Core:4.2.21.2) Thu, 09 Jun 2016 05:46:19 +0000”

Start TLS is a banner advertise to let people know we accept TLS connections. 220 is a proper code and means it’s ready to accept.
Smtp.sparkpostmail.com is the hostname of the server you’ve connected to.
ESMTP is the protocol that is being used
Ecelerity 4.2.21.55447 r(Core:4.2.21.2) is the name and version number of the service that is handling this connection and the SMTP conversation, which is broadcasted when a connection is made.
(And of course, the time stamp.)

This, however, seems like an error on your application: “Unable to send email using PHP SMTP. Your server might not be configured to send mail using this method.”

For example 2, the response is similar, but the placement is odd. We don’t send a EHLO more than once so likely your application did not like the EHLO and reported the error after the other status codes were sent. “.0.0 continue” looks like a truncated part of the SMTP conversation, which should look more like this

data
354 3.0.0 continue.  finished with "\r\n.\r\n"

I'm not sure your application is interpreting those as errors, as they're all standard parts of the SMTP conversation. Since there are so many different jumps, it's certainly possible that your application is timing out or packets could be dropped between jumps. I would check to make sure if there are any packets dropped in the conversation (as that may be why you application is not recognizing the lines) and if not, why your application is not recognizing parts of the SMTP conversation. Thank you.

Does it mean something to one of you ?

Thank you very much