In my Rails 2 apps I always used sanitize email to send all emails in development to my personal account to avoid accidentally sending out emails or to use just for testing.
This doesn't seem to have a Rails 3 version and wondered if there was anything for Rails 3 that does this.
Take a look at How to intercept ActionMailer's messages on rails 3?. You'll only have to add message.to = my@email
and the mail will be sent to your email address instead of the original destination.
This is what I ended up doing from the post linked to above:
if Rails.env.development?
class Hook
def self.delivering_email(message)
message.to = "\"#{message.to.first}\" <[email protected]>"
message.cc = nil if !message.cc.nil?
message.bcc = nil if !message.bcc.nil?
end
end
ActionMailer::Base.register_interceptor(Hook)
end
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With