Created
August 25, 2020 08:58
-
-
Save ritikesh/5444ecfe4ff94aa540d05daa693cab0b 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
module MailObserver | |
def self.delivered_email(mail) | |
logger = ActionMailer::Base.logger | |
logger.tagged(mail.message_id) do | |
logger.info do | |
recipients = Array(mail.to).join(', ') | |
"Sent mail to #{recipients}" | |
end | |
end | |
logger.debug { mail.encoded } | |
end | |
end | |
ActionMailer::Base.register_observer(MailObserver) | |
module MailLogSubscriber | |
def deliver(event) | |
# no-op | |
end | |
end | |
ActionMailer::LogSubscriber.prepend(MailLogSubscriber) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment