diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-11-15 16:12:23 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-11-15 16:17:45 +0000 |
commit | 388c75bfbd18fcaf273d95c21dc132ad19f0cefe (patch) | |
tree | 74da159b16879ed9ee52b7d1abddc9005f606877 /lib/mail_handler/backends/tmail_backend.rb | |
parent | c22653c85c8029bf2ee193eb892bad1f3d0e93fe (diff) |
Move handling of TNEF mail attachments to mail handler
Diffstat (limited to 'lib/mail_handler/backends/tmail_backend.rb')
-rw-r--r-- | lib/mail_handler/backends/tmail_backend.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lib/mail_handler/backends/tmail_backend.rb b/lib/mail_handler/backends/tmail_backend.rb index fc675c1ed..4daa5469f 100644 --- a/lib/mail_handler/backends/tmail_backend.rb +++ b/lib/mail_handler/backends/tmail_backend.rb @@ -18,6 +18,19 @@ module MailHandler mail end + # Extracts all attachments from the given TNEF file as a TMail::Mail object + def mail_from_tnef(content) + main = TMail::Mail.new + main.set_content_type 'multipart', 'mixed', { 'boundary' => TMail.new_boundary } + tnef_attachments(content).each do |attachment| + tmail_attachment = TMail::Mail.new + tmail_attachment['content-location'] = attachment[:filename] + tmail_attachment.body = attachment[:content] + main.parts << tmail_attachment + end + main + end + end end end
\ No newline at end of file |