【发布时间】:2011-07-03 05:16:00
【问题描述】:
我正在尝试发送一封包含单个 HTML 附件的电子邮件。问题是附件 html 出现在电子邮件正文中,并且视图显示为附件。和我预想的差不多。
我能够正确发送其他类型的附件,但是当尝试发送单个 HTML 附件时,它始终显示而不是“附加”。
class Notifier < ActionMailer::Base
default :from => "from@example.com"
def welcome(email)
attachments['this is an html file.html'] = "<b>yeah this is html!</b>"
mail(:to => email, :subject => "Attempting an attachment")
end
end
还有我的app/views/notifier/welcome.html.erb
Hi there! This is <b>html</b> within a view
生成的电子邮件如下所示:
(请注意附件 html 实际显示在电子邮件正文中)
【问题讨论】:
标签: ruby-on-rails attachment actionmailer