Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
Set staging environment email to go to a single email address you control in order to not accidentally send production email addresses staging data.
module SingleRecipientSmtp
def self.included(clazz)
clazz.class_eval do
cattr_accessor :single_recipient_smtp_settings
def perform_delivery_single_recipient_smtp(mail) = single_recipient_smtp_settings[:to] = nil
mail.bcc = nil
perform_delivery_smtp mail
config.action_mailer.delivery_method = :single_recipient_smtp
ActionMailer::Base.send :include, SingleRecipientSmtp
ActionMailer::Base.single_recipient_smtp_settings = {
:to => ''
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment