小编Joe*_*gen的帖子

Mandrill raw_message中的额外"\n"打破了一些链接

我通过SMTP从Heroku的Rails应用程序发送电子邮件到Mandrill.

一切都运行良好一段时间,但最近(2天前检测到),我们收到报告称某些链接已损坏.

当我通过SMTP将消息发送到Mailtrap时,原始消息很好,HTML主体在一行中.

但是,在Mandrill上,raw_messageAPI调用中出现的内容包含extra \n(这是一个换行后跟一个空格).

运气不好,链接显示如下:

<a href=\"https://www.\n facebook.com/
Run Code Online (Sandbox Code Playgroud)

链接跟踪开启后,将转换为:

https://www.%20facebook.com/
Run Code Online (Sandbox Code Playgroud)

链接跟踪关闭,邮箱理解如下:

https://www.%0d%0a%20facebook.com/
Run Code Online (Sandbox Code Playgroud)

在这两种情况下,链接显然都被打破了.看到SMTP消息看起来很好,我猜测Mandrill的SMTP服务器在调用API时添加换行符.我该怎么办?我怎么能成为唯一一个看似受影响的人呢?

任何帮助都很受欢迎,包括解决方法,因为这也打破了生产中的"重置密码"链接!

编辑

这是我在mailtrap中获得的(略微编辑的)原始消息.这是多部分文本/ HTML,一切看起来都不错.

Date: Thu, 26 Feb 2015 16:11:49 +0000
From: redacted <notifications+staging@redacted.com>
Reply-To: redacted <support@redacted.io>
To: redacted@redacted.com
Message-ID: <54ef45c51372b_3a3fddaa4e53f081961@3d32585e-59a2-456b-b7ff-4ed464b73400.mail>
Subject: Reset password instructions
Mime-Version: 1.0
Content-Type: multipart/alternative;
 boundary="--==_mimepart_54ef45c510602_3a3fddaa4e53f081842";
 charset=UTF-8
Content-Transfer-Encoding: 7bit


----==_mimepart_54ef45c510602_3a3fddaa4e53f081842
Content-Type: text/plain;
 charset=UTF-8
Content-Transfer-Encoding: 7bit

Hello redacted,

Someone has requested a link to change your password for redacted. You can do this through the link below.

http://redacted.io/security/users/password/edit?reset_password_token=redacted

If you …
Run Code Online (Sandbox Code Playgroud)

ruby-on-rails mandrill

5
推荐指数
1
解决办法
787
查看次数

标签 统计

mandrill ×1

ruby-on-rails ×1