通过sendgrid发送的纯文本电子邮件中的额外换行符 [英] extra newlines in plain text emails sent via sendgrid

查看:810
本文介绍了通过sendgrid发送的纯文本电子邮件中的额外换行符的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用CodeIgniter(v1.7)和PHPMailer(v5.1)从PHP发送纯文本的电子邮件。当前生产设置使用一个便宜的SMTP中继,计划是切换到CritSend或SendGrid。我们现在正从Rackspace Cloud服务器测试选项。



当我们使用SendGrid SMTP所有\r\\\
emlines中的换行符最终被加倍,因此最终为\r\\\
\r\\\



使用CritSend SMTP和其他两个SMTP服务器时,所有工作都正常。 / p>

SendGrid技术支持不认为它是与他们的系统有关,但听说过另一个客户端有相同的问题,显然它得到了解决与配置更改客户端。



任何人体验过这个?



这对我们来说并不重要,因为CritSend运行良好,在SendGrid的功能上看起来不错,所以我们将一起使用。 BUT是一个好奇的类型,我只是不能让这一切: - )



通常设置:PHP脚本 - > sendmail / Postfix - >外部SMTP中继 - >。 ...



要测试不同的SMTP中继我更改postfix配置,只有SendGrid给出额外的换行符所有其他SMTP选项工作正常。



备用设置:PHP脚本(CI邮件类或PHPMialer) - >通过CodeIgniter电子邮件类调试功能转储电子邮件。外部SMTP中继 - > ....



要测试不同的SMTP中继,请更改CI电子邮件配置或PHPMialer配置中的SMTP设置。只有SendGrid给出额外的换行符,所有其他的SMTP选项都可以正常工作。



我可以看到没有所有的选项。我尝试了utf-8和ISO-something或其他,我们这边的所有换行符是\r\\\
......在某个地方像一些非常模糊的bug。



有什么想法吗?

解决方案

从PHPMailer很好地传送SendGrid:

  $ mailer-> CharSet =utf-8 
$ mailer-> LE =\r\\\
;
$ mailer-> Encoding =quoted-printable;
$ mailer-> WordWrap = 80;

quoted-printable部分是关键。


We send emails in plain text from PHP using CodeIgniter (v1.7) and also PHPMailer (v5.1). Current production setup uses a cheapie SMTP relay, plan is to switch to a CritSend or SendGrid. We are testing the options now from a Rackspace Cloud server.

When we use SendGrid SMTP all "\r\n" newlines in the emials end up being doubled up, so end up as "\r\n\r\n".

All works fine when using CritSend SMTP and also two other SMTP servers.

SendGrid tech support don't think it is anything to do with their system, but have heard of another client with the same issue and apparently it got solved with a config change on the client's side.

Anyone experienced this?

This isn't critical for us as CritSend works well and seems as good as SendGrid on features, so we will go with them. BUT being a curious type, I just can't let this go :-)

Usual setup: PHP script -> sendmail/Postfix -> external SMTP relay -> ....

To test the different SMTP relays I change the postfix config, only SendGrid gives the extra newlines all other SMTP options work fine. If I dump the email via CodeIgniter email class debug function it looks fine before it goes to postfix.

Alternate setup: PHP script (either CI mail class or PHPMialer) -> external SMTP relay -> ....

To test the different SMTP relays I change the SMTP settings in the CI email config or PHPMialer config. Only SendGrid gives the extra newlines all other SMTP options work fine.

There aren't all that many options to play with as far as I can see. I tried "utf-8" and "ISO-something or other", all newlines on our side are "\r\n"...... seesm like some very obscure bug somewhere.

Any ideas?

解决方案

OK, a bit more experimenting and these settings make plain text emails go trough SendGrid nicely from PHPMailer:

    $mailer->CharSet    = "utf-8";
    $mailer->LE         = "\r\n";
    $mailer->Encoding   = "quoted-printable";
    $mailer->WordWrap   = 80;

The "quoted-printable" part is the key.

这篇关于通过sendgrid发送的纯文本电子邮件中的额外换行符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆