Created
March 6, 2009 13:04
-
-
Save henrik/74903 to your computer and use it in GitHub Desktop.
Cancel mail from within an ActionMailer deliver_* method.
This file contains 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
# Allow cancelling mails from within an ActionMailer deliver_* method by doing "raise NotSendingMail". | |
# In an ApplicationMailer that other mailers inherit from: | |
class NotSendingMail < StandardError; end | |
def self.method_missing(*args) | |
super | |
rescue NotSendingMail => e | |
Rails.logger.info("Not mailing! #{e}") | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment