aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouise Crow <louise.crow@gmail.com>2012-11-15 11:51:45 +0000
committerLouise Crow <louise.crow@gmail.com>2012-11-15 11:51:45 +0000
commit54e4c6efa6c670b1a2b1b94e59216f85d83299be (patch)
tree48eb6ca2c79fcb09750e52a9caaed7dd76b18483
parentddb1880518a2fcfeeae849e54de4b9fc3cb33dc5 (diff)
Move generation of mail object from incoming message to mail handler.
-rw-r--r--app/models/incoming_message.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index d19b258a7..4ae0b8520 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -62,17 +62,10 @@ class IncomingMessage < ActiveRecord::Base
'application/zip' => 1,
}
- # Return the structured TMail::Mail object
- # Documentation at http://i.loveruby.net/en/projects/tmail/doc/
+ # Return a cached structured mail object
def mail(force = nil)
if (!force.nil? || @mail.nil?) && !self.raw_email.nil?
- # 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 = self.raw_email.data.gsub(/; boundary=\s+"/im,'; boundary="')
-
- @mail = TMail::Mail.parse(copy_of_raw_data)
- @mail.base64_decode
+ @mail = MailHandler.mail_from_raw_email(self.raw_email.data)
end
@mail
end