Created
August 25, 2020 08:58
-
-
Save ritikesh/57445f40e9447f0fa9b5e7c98b4e166d to your computer and use it in GitHub Desktop.
blog gists
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
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