Skip to content

Instantly share code, notes, and snippets.

@ritikesh
Created August 25, 2020 08:58
Show Gist options
  • Save ritikesh/57445f40e9447f0fa9b5e7c98b4e166d to your computer and use it in GitHub Desktop.
Save ritikesh/57445f40e9447f0fa9b5e7c98b4e166d to your computer and use it in GitHub Desktop.
blog gists
class MailboxInterceptor
def self.delivering_email(mail)
set_smtp_settings(mail)
fix_encodings
mail.perform_deliveries = Rails.env.production? || File.exists?("#{Rails.root}/tmp/send_emails.txt")
ensure
unset_email_config
end
end
ActionMailer::Base.register_interceptor(MailboxInterceptor)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment