Skip to content

Instantly share code, notes, and snippets.

@cbartlett
Created June 29, 2011 19:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cbartlett/1054773 to your computer and use it in GitHub Desktop.
Save cbartlett/1054773 to your computer and use it in GitHub Desktop.
Mail Interceptor
Mail.register_interceptor(StagingMailInterceptor) if Rails.env.staging? || Rails.env.acceptance?
class StagingMailInterceptor
def self.delivering_email(message)
unless message.to.all? { |email| email.ends_with?("loosecubes.com") }
message.subject = "#{message.subject} (#{message.to.join(', ')})"
message.to = "admin+staging@loosecubes.com"
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment