aboutsummaryrefslogtreecommitdiffstats
path: root/lib/mail_handler/backends
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2013-02-14 18:56:16 +0000
committerLouise Crow <louise.crow@gmail.com>2013-02-14 19:03:40 +0000
commitbc0cc811e80143d0255d86433a80a823d1141dd0 (patch)
tree0c5005b2b03e540d8ab562da06539414709fbc18 /lib/mail_handler/backends
parent6fa9c17c7cd5551489a77f6e89543b7886be51d4 (diff)
parent2c5749d4d92e6601856cef6f7e2201d06d885183 (diff)
Merge branch 'release/0.7'0.7.00.7
Diffstat (limited to 'lib/mail_handler/backends')
-rw-r--r--lib/mail_handler/backends/mail_backend.rb3
-rw-r--r--lib/mail_handler/backends/tmail_backend.rb10
2 files changed, 5 insertions, 8 deletions
diff --git a/lib/mail_handler/backends/mail_backend.rb b/lib/mail_handler/backends/mail_backend.rb
index b75e6ed63..0a12ab3bb 100644
--- a/lib/mail_handler/backends/mail_backend.rb
+++ b/lib/mail_handler/backends/mail_backend.rb
@@ -8,8 +8,7 @@ module MailHandler
'Mail'
end
- # Note that the decode flag is not yet used
- def mail_from_raw_email(data, decode=true)
+ def mail_from_raw_email(data)
Mail.new(data)
end
diff --git a/lib/mail_handler/backends/tmail_backend.rb b/lib/mail_handler/backends/tmail_backend.rb
index 02124cdb1..1e241f261 100644
--- a/lib/mail_handler/backends/tmail_backend.rb
+++ b/lib/mail_handler/backends/tmail_backend.rb
@@ -8,14 +8,12 @@ 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, decode=true)
+ def mail_from_raw_email(data)
# 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 if decode
- mail
+ TMail::Mail.parse(copy_of_raw_data)
end
# Extracts all attachments from the given TNEF file as a TMail::Mail object
@@ -105,12 +103,12 @@ module MailHandler
if part.content_type == 'message/rfc822'
# An email attached as text
# e.g. http://www.whatdotheyknow.com/request/64/response/102
- part.rfc822_attachment = mail_from_raw_email(part.body, decode=false)
+ part.rfc822_attachment = mail_from_raw_email(part.body)
elsif part.content_type == 'application/vnd.ms-outlook' || part_filename && AlaveteliFileTypes.filename_to_mimetype(part_filename) == 'application/vnd.ms-outlook'
# An email attached as an Outlook file
# e.g. http://www.whatdotheyknow.com/request/chinese_names_for_british_politi
msg = Mapi::Msg.open(StringIO.new(part.body))
- part.rfc822_attachment = mail_from_raw_email(msg.to_mime.to_s, decode=false)
+ part.rfc822_attachment = mail_from_raw_email(msg.to_mime.to_s)
elsif part.content_type == 'application/ms-tnef'
# A set of attachments in a TNEF file
part.rfc822_attachment = mail_from_tnef(part.body)