Skip to content

Instantly share code, notes, and snippets.

@mpouleijn
Created May 31, 2012 10:09
Show Gist options
  • Save mpouleijn/2842408 to your computer and use it in GitHub Desktop.
Save mpouleijn/2842408 to your computer and use it in GitHub Desktop.
Mail Interceptor
# Register the interceptor for a environment
#
require "mail_interceptor"
AppName::Application.configure do
#...
config.action_mailer.register_interceptor(MailInterceptor)
end
# This file can be placed in the /lib folder
#
# Class will over write the subject and receivers information,
# register this interceptor in each environment you don't want
# to send emails to your customers
#
class MailInterceptor
 def self.delivering_email(message)
   message.subject = "#{message.to} #{message.subject}"
   message.to = "info@example.com"
 end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment