2
在轨2.3.5我们能附着邮件作为附件发送到其是使用下面的代码多部分邮件等电子邮件:连接电子邮件至电子邮件轨2.3.5升级到轨3.017
recipients to
from from
subject subject
content_type "multipart/mixed"
part "text/html" do |p|
p.body = render_message("rampup_notification.text.html.erb", :mailbody => body)
end
part "text/plain" do |p|
p.body = render_message("rampup_notification.text.plain.erb", :mailbody => body)
end
email = enrollment_application.email
if email != nil && email.raw_email != nil
attachment :content_type => "message/rfc822", :filename => "icann.eml", :body => email.raw_email, :transfer_encoding => '7bit'
end
与其他邮件程序一起,我们非常喜欢与Outlook,Exchange等工作。
如何在rails 3中执行此操作?
我看到:http://www.rubydoc.info/docs/rails/3.0.0/ActionMailer/Base:attachments
encoded_content = SpecialEncode(File.read('/path/to/filename.jpg'))
attachments['filename.jpg'] = {:mime_type => 'application/x-gzip',
:encoding => 'SpecialEncoding',
:content => encoded_content }
但我不知道如何使用这个,是SpecialEncode一类我需要写,做7位编码?
感谢 乔尔