要使用什么content_type - 在Mandrill-api gem上获取无边界错误(Rails 4.1)

时间:2015-08-04 17:46:34

标签: ruby-on-rails ruby ruby-on-rails-4 actionmailer mandrill

没有附件的电子邮件发送正常,但是当有附件时,我会在mandril上出现边界丢失错误:

{
"code": -98,
"name": "ValidationError",
"message": "Invalid raw_message: Bad multipart message - no boundary"
}
  • 开发模型中的开信刀显示电子邮件呈现完美

电子邮件是html(通过Mandrill呈现没有问题)并且将具有PDF附件。

对邮件的致电是:

# template variables
merge_vars = {"AMOUNT" => "100"}

invoice = Invoice.new(customer)

attachments[invoice.name] = {
  data: invoice.invoice_data,
  mime_type: 'application/pdf'
}

content_type = "multipart/mixed"

mail(to: user.email, cc: cc_emails.compact.uniq, subject: mail_subject, content_type: content_type) do |format|
  # Template renders fine
  format.html{mandrill_template('invoice_template', merge_vars)}
end

Mandril gem版本1.0.53和Rails 4.1.10。

0 个答案:

没有答案