Created
March 15, 2012 06:32
-
-
Save croaky/2042496 to your computer and use it in GitHub Desktop.
Set staging environment email to go to a single email address you control in order to not accidentally send production email addresses staging data.
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
module SingleRecipientSmtp | |
def self.included(clazz) | |
clazz.class_eval do | |
cattr_accessor :single_recipient_smtp_settings | |
end | |
end | |
def perform_delivery_single_recipient_smtp(mail) | |
mail.to = single_recipient_smtp_settings[:to] | |
mail.cc = nil | |
mail.bcc = nil | |
perform_delivery_smtp mail | |
end | |
end |
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
config.action_mailer.delivery_method = :single_recipient_smtp | |
ActionMailer::Base.send :include, SingleRecipientSmtp | |
ActionMailer::Base.single_recipient_smtp_settings = { | |
:to => '[email protected]' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment