【问题标题】:Sendgrid GEM bug while sending plain/text e-mail发送纯/文本电子邮件时的 Sendgrid GEM 错误
【发布时间】:2016-03-02 21:22:59
【问题描述】:

我正在尝试通过 sendgrid gem 发送一封电子邮件以获取 ruby​​ on rails。 这是我的邮件代码:

def send_form(params)
  @params=params
  mail( :to => 'my_email',
    :subject => 'my_subject',:content_type => "text/plain")
end

它正在加载我的视图 send_form.json.erb 并且在视图中有这样的:

<%= raw @params.to_json %>

现在,这里的问题是来自电子邮件的源代码有 2 封电子邮件(?),一封是纯文本的,另一封是 HTML 的。

    This is a multi-part message in MIME format...

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

{"versao":"cee'd SW - 1.6 CRDi ISG EX","concessionario":"Sotabi","extraEmail":"gerencia@sotabi.p","nome":"Miguel Rebola","email":"miguelrebola21@gmail.com","telefone":"968823502","comentarios":"fdfd","autorizo":"yes"}

------------=_1448758618-20748-809
Content-Type: text/html; charset="UTF-8"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

<html><body>
<p>{&quot;versao&quot;:&quot;cee'd SW &ndash; 1.6 CRDi ISG EX&quot;,&quot;concessionario&quot;:&quot;Sotabi&quot;,&quot;extraEmail&quot;:&quot;gerencia@sotabi.p&quot;,&quot;nome&quot;:&quot;Miguel Rebola&quot;,&quot;email&quot;:&quot;miguelrebola21@gmail.com&quot;,&quot;telefone&quot;:&quot;968823502&quot;,&quot;comentarios&quot;:&quot;fdfd&quot;,&quot;autorizo&quot;:&quot;yes&quot;}</p>

<img src="https://u1373375.ct.sendgrid.net/wf/open?upn=u0x3fSBqEx-2Fl-2BmgujqmE8BQomXBLbogF-2Bc6F-2BtlRZ6DF0HBXi526k5pl8ZUC-2FxtIp9ic36mMF2aQ4d6eJ5Lqq9panqdI3Ye7hmz4ajbhDO44ePVyM2SMDDBBWWMpJ5l50gYvbwVmo7S80MmO-2BlSAaFwiQpqgTXdMFRmz0vHxy-2BdXYgxbqCs5K3msoeQ4SQS-2BZqoqDpo2wVLTeQrEbKzxE2cQn1u-2FORF6fYLTNqw560g-3D" alt="" width="1" height="1" border="0" style="height:1px !important;width:1px !important;border-width:0 !important;margin-top:0 !important;margin-bottom:0 !important;margin-right:0 !important;margin-left:0 !important;padding-top:0 !important;padding-bottom:0 !important;padding-right:0 !important;padding-left:0 !important;"/>
</body></html>

我只需要发送纯文本/文本。有什么想法吗??

【问题讨论】:

  • 这实际上是 HTML 电子邮件的默认格式,它们通常包含用于缺乏 HTML 支持的旧电子邮件客户端的纯文本部分。至于自动转换,也许是这个support.sendgrid.com/hc/en-us/articles/…?另外,您是否尝试过将:html 设置为空字符串并仅使用:text?

标签: ruby-on-rails ruby email sendgrid


【解决方案1】:

进入设置https://app.sendgrid.com/settings/mail_settings

找到Plain Content参数并打开它。

【讨论】:

    【解决方案2】:

    需要在 Sendrigd 网站上更改配置。

    【讨论】:

    • 你能建议哪一个吗?
    • 仪表板、设置、纯内容
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-08-10
    • 1970-01-01
    • 1970-01-01
    • 2021-12-05
    • 2020-04-17
    • 2011-09-10
    • 2018-08-09
    相关资源
    最近更新 更多