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位編碼?
感謝 喬爾