Last active
August 29, 2015 14:00
-
-
Save scrogson/e266ef4c4b75cfdefa84 to your computer and use it in GitHub Desktop.
Intercept outgoing email in environments outside of production.
This file contains hidden or 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/initializers/sandbox_email_interceptor.rb | |
ActionMailer::Base.register_interceptor(SandboxEmailInterceptor) unless Rails.env.production? |
This file contains hidden or 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
# lib/sandbox_email_interceptor.rb | |
class SandboxEmailInterceptor | |
def self.delivering_email(message) | |
message.to = [Secrets.smtp["from"]] | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment