0

我使用电子邮件库使用 SMTP 发送邮件。

我正在使用 Mandrill,一切正常。

我现在使用 SparkPost,但出现不规则错误。CI 库偶尔返回空白错误。完全相同的邮件可以工作十次而失败一次。

我的配置:

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

以下是我遇到的错误示例print_debugger()

> 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:   
>The following SMTP error was encountered: 
>starttls:  
>The following SMTP error was encountered:  
>The following SMTP error was encountered: .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  

当我只使用 Sparkpost 得到这些错误时,我问了他们,​​这是他们的答案:

您粘贴的错误是 SMTP 转换的常规部分。例如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”</p>

Start TLS 是一个横幅广告,让人们知道我们接受 TLS 连接。220 是正确的代码,表示它已准备好接受。
Smtp.sparkpostmail.com 是您连接的服务器的主机名。ESMTP 是正在使用的协议
Ecelerity 4.2.21.55447 r(Core:4.2.21.2) 是处理此连接和 SMTP 会话的服务的名称和版本号,在建立连接时广播。(当然还有时间戳。)

但是,这似乎是您的应用程序中的一个错误:“无法使用 PHP SMTP 发送电子邮件。您的服务器可能未配置为使用此方法发送邮件。”</p>

例如 2,响应相似,但位置奇数。我们不会多次发送 EHLO,因此您的应用程序可能不喜欢 EHLO,并在发送其他状态代码后报告错误。“.0.0 continue”看起来像是 SMTP 会话的截断部分,应该看起来更像这样

数据
354 3.0.0 继续。以“\r\n”结束。\r\n

我不确定您的应用程序是否将这些解释为错误,因为它们都是 SMTP 对话的标准部分。由于有很多不同的跳转,您的应用程序肯定有可能超时或在跳转之间可能会丢弃数据包。我会检查以确保会话中是否有任何数据包丢失(因为这可能是您的应用程序无法识别线路的原因),如果没有,为什么您的应用程序无法识别部分 SMTP 会话。谢谢你。

这对你们中的任何一个人来说意味着什么吗?

非常感谢

4

0 回答 0