Tag: email attachments

发送带附件的电子邮件

我有一个邮件如下: class Payments::LateNoticesMailer < AsyncMailer def notice(payment_id) @payment = PaymentDecorator.find(payment_id) @invoice = @payment.invoice template = "payments/invoices/#{@payment.made_with_type.downcase}/show" attachments["#{@payment.invoice_filename}.pdf"] = WickedPdf.new.pdf_from_string( render_to_string( pdf: @payment.invoice_filename, formats: [:pdf], template: template, layout: "layouts/pdf.html")) mail to: @payment.payer_email, from: '"RentingSmart" ‘, cc: @payment.landlord_email, subject: “*** Your rent payment of #{@payment.amount_due} is overdue ***” end end 我用SendGrid发送的。 这是我的问题,如果我通过Gmail打开电子邮件,一切都很好,电子邮件的文本就在那里,并附上附件。 但是,如果我使用OSX的Mail.app或我的iPhone打开它,我只需得到以下内容: 这是MIME格式的多部分消息… 有人有任何提示吗? 我想我正在遵循Rails指南。 这是我拨打Payments::LateNoticesMailer.notice(payment.id).deliver