Skip to content

Instantly share code, notes, and snippets.

@philm
Created December 20, 2012 03:11
Show Gist options
  • Save philm/4342652 to your computer and use it in GitHub Desktop.
Save philm/4342652 to your computer and use it in GitHub Desktop.
Rails mail interceptor
# config/initializers/mail.rb
ActionMailer::Base.register_interceptor(MailInterceptor) if Rails.env.staging?
# 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