Skip to content

Instantly share code, notes, and snippets.

@devton
Created April 20, 2012 16:34
Show Gist options
  • Save devton/2430160 to your computer and use it in GitHub Desktop.
Save devton/2430160 to your computer and use it in GitHub Desktop.
Mailer interceptor
#config/initializers/interceptor.rb
require "#{Rails.root}/lib/development_mail_interceptor"
ActionMailer::Base.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
#lib/development_mail_interceptor.rb
class DevelopmentMailInterceptor
def self.delivering_email(message)
message.subject = "[#{message.to}] #{message.subject}"
message.to = `git config --global user.email`.strip
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment