1
我想发送一个包含单个HTML附件的电子邮件。问题是附件HTML出现在电子邮件的正文中,并且该视图显示为附件。几乎与我预期的相反。发送与ActionMailer的HTML附件3
我能够正确地发送其他类型的附件,但是当试图发送一个HTML附件时,它始终显示而不是“附加”。
class Notifier < ActionMailer::Base
default :from => "[email protected]"
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实际上是显示在电子邮件正文)
感谢您的信息。我仍然想知道为什么显示附件,并且视图是以没有文件名的HTML附件的形式发送的。有些事情是不正确的。通过这个基于Web的邮件客户端,我可以附加一个html文件,并按预期工作。我认为我正在用actionmailer做一些不正确的事情。 – olore 2011-05-14 02:47:19