Created
May 10, 2016 22:08
-
-
Save psugihara/3caa217486f86a848d6abf21d734b15e to your computer and use it in GitHub Desktop.
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
if Rails.env.staging? || Rails.env.development? | |
class MailFilter | |
def self.delivering_email(message) | |
message.to = message.to.reject {|recipient| recipient !~ /@openlistings.com/i } | |
if message.to.blank? | |
message.perform_deliveries = false | |
Rails.logger.debug "Interceptor prevented sending mail #{message.inspect}!" | |
end | |
message.subject = "[#{Rails.env.upcase}] " + message.subject | |
end | |
end | |
ActionMailer::Base.register_interceptor(MailFilter) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment