发送 plain/text 电子邮件时 Sendgrid GEM 错误

Sendgrid GEM bug while sending plain/text e-mail

我想在 rails 上通过 sendgrid gem 为 ruby 发送一封电子邮件。 这是我的邮件程序代码:

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>

我只需要发送 plain/text。有什么想法吗??

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

转到“设置”https://app.sendgrid.com/settings/mail_settings

找到纯内容参数并将其打开。