Created
July 23, 2010 01:23
-
-
Save monde/486883 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MailReceiver < ActionMailer::Base | |
# patch ActionMailer::Base to put a ActionMailer::Base#raw_email | |
# accessor on the created instance | |
class << self | |
alias :old_receive :receive | |
def receive(raw_email) | |
send(:define_method, :raw_email) { raw_email } | |
self.old_receive(raw_email) | |
end | |
end | |
## | |
# Injest email/MMS here | |
def receive(tmail) | |
# completely ignore the tmail object rails passes in Rails 2.* | |
mail = Mail.new(self.raw_email) | |
mms = MMS2R::Media.new(mail, :logger => Rails.logger) | |
# do something | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment