我处于整个电子邮件及其部分以正确顺序生成并嵌套的位置......除了一件小事。 :part_container参数在文本/ html部分的上方插入内联附件,而不是在下面。如果在上面,Thunderbird将不会显示任何内容,并会显示电子邮件为2个外部附件。如果我手动编辑电子邮件并将text/html部分下方的内联部分移动,它会完美显示。Rails 2.3“inline_attachment”gem内联附件的位置不正确
part :content_type => 'multipart/alternative' do |copy|
copy.part :content_type => 'text/plain' do |plain|
plain.body = render(
:file => "main.text.plain",
:body => {
:user => @user,
:text => docParse.to_plain_text
}
)
end
copy.part :content_type => 'multipart/related' do |rel|
rel.part :content_type => 'text/html' do |html|
html.body = render(
:file => "main.text.html",
:body => {
:part_container => rel,
:user => @user,
:content => content,
:email_links => m.email_links,
:nav_image => m.nav_image
}
)
end
end
end
m.attachments.each do |file|
attachment :content_type => "application/octet-stream",
:filename => File.basename(file),
:body => File.read(file)
end
要明确的是,inline_attachments宝石完美的作品没有任何这段代码的 - 但只有当我发送邮件,无需任何外部附件(只内嵌图片)。当我想发送带有内嵌图像和外部附件的HTML电子邮件时,这是我必须诉诸的。
编辑:要清楚,我的问题是:“我如何确保该内嵌附件部分text/html的一部分使用后产生的?part_container
没人?该死... – JakeTheSnake