Reputation: 22198
Without editing any of my /app
files, I'd like to edit either development.rb
or an initializer where I set a whitelist of testers.
Then the emails are sent only to those people in the whitelist (not to spam other users mailbox).
I though of overriding deliver!
, or the user.get_mail
method but :
/config
where it should beUpvotes: 1
Views: 1053
Reputation: 20878
You might want to check out Action mailer interceptors
And do something like this :
class BetaEmailInterceptor
def self.delivering_email(message)
message.perform_deliveries = false unless WHITELIST.include?(message.to.first)
end
end
And
ActionMailer::Base.register_interceptor(BetaEmailInterceptor)
This is a very naive implementation and will only work if the first recipient is whitelisted but you get the idea.
Upvotes: 3