Skip to content

Instantly share code, notes, and snippets.

@nikz
Created June 8, 2009 06:12
Show Gist options
  • Select an option

  • Save nikz/125662 to your computer and use it in GitHub Desktop.

Select an option

Save nikz/125662 to your computer and use it in GitHub Desktop.
class ActionMailer::Base
cattr_accessor :delayed_mail_handler
class << self
def method_missing_with_delayed_mail_handling(name, *args)
if @@delayed_mail_handler
@@delayed_mail_handler.to_s.classify.constantize.handle_mail(self, name, *args)
else
method_missing_without_delayed_mail_handling(name, *args)
end
end
alias_method_chain :method_missing, :delayed_mail_handling
def deliver_delayed_mail(name, *args)
new(name, *args).deliver!
end
end
end
ActionMailer::Base.delayed_mail_handler = :sqs_mail_handler
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment