Created
March 10, 2024 05:28
-
-
Save dpaluy/3388fce2ea56a54062bdca5c71cc5975 to your computer and use it in GitHub Desktop.
Rails staging email interceptor
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
# config/initializers/email_interceptors.rb | |
if Rails. env.staging? | |
ActionMailer::Base.register_interceptors(Interceptors::StagingEmailInterceptor) | |
end |
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
# app/mailers/interceptors/staging_email_interceptor.rb | |
class Interceptors::StagingEmailInterceptor | |
def self.delivering_email(email) | |
email.to = "devs@example.com" | |
email.subject = "(TEST)" + email.subject | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment