diff options
author | Louise Crow <louise.crow@gmail.com> | 2012-11-15 12:48:16 +0000 |
---|---|---|
committer | Louise Crow <louise.crow@gmail.com> | 2012-11-15 12:48:16 +0000 |
commit | 8834f67db8cd94a0285dd1bb4702db834e08e995 (patch) | |
tree | cb0ef11ec7aa415c77cfc7eb4cc6d53d668c5e08 /lib | |
parent | fc8b05dc1da99800be72b3d3d0058522464239f1 (diff) |
Use mail handler for making mail objects of attached emails. Add a flag to use base64 decoding or not. Note that currently the Mail-based backend doesn't use it - I think that eventually we'll want to have the mail handler wrap the mail object with it's own interface.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/mail_handler/backends/mail_backend.rb | 3 | ||||
-rw-r--r-- | lib/mail_handler/backends/tmail_backend.rb | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb index f7dbb7624..6a5fff13f 100644 --- a/lib/mail_handler/backends/mail_backend.rb +++ b/lib/mail_handler/backends/mail_backend.rb @@ -8,7 +8,8 @@ module MailHandler 'Mail' end - def mail_from_raw_email(data) + # Note that the decode flag is not yet used + def mail_from_raw_email(data, decode=true) Mail.new(data) end diff --git a/lib/mail_handler/backends/tmail_backend.rb b/lib/mail_handler/backends/tmail_backend.rb index ff00d92df..2f59b1161 100644 --- a/lib/mail_handler/backends/tmail_backend.rb +++ b/lib/mail_handler/backends/tmail_backend.rb @@ -17,13 +17,13 @@ module MailHandler # Turn raw data into a structured TMail::Mail object # Documentation at http://i.loveruby.net/en/projects/tmail/doc/ - def mail_from_raw_email(data) + def mail_from_raw_email(data, decode=true) # Hack round bug in TMail's MIME decoding. # Report of TMail bug: # http://rubyforge.org/tracker/index.php?func=detail&aid=21810&group_id=4512&atid=17370 copy_of_raw_data = data.gsub(/; boundary=\s+"/im,'; boundary="') mail = TMail::Mail.parse(copy_of_raw_data) - mail.base64_decode + mail.base64_decode if decode mail end |