Created
December 20, 2012 03:11
-
-
Save philm/4342652 to your computer and use it in GitHub Desktop.
Rails mail interceptor
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
# config/initializers/mail.rb | |
ActionMailer::Base.register_interceptor(MailInterceptor) if Rails.env.staging? |
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
# app/models/mail_interceptor.rb | |
class MailInterceptor | |
def self.delivering_email(message) | |
message.subject = "[#{message.to}] #{message.subject}" | |
message.to = "[email protected]" | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment