Sanity check please - Rails console #6

Closed
magpieuk opened this Issue Oct 28, 2011 · 5 comments

3 participants

@magpieuk

I love the mail safe gem and its a great tool, but can someone else please check to see whether it protects email sent from the console.

It seems to protect when running as a server but not from a console.

@myronmarston

It should work fine from the rails console. Mail safe itself doesn't know anything about the rails console; it simply does its job if it has been required, and has no effect if it has not been required.

Can you verify that mail safe has been required when you log into your rails console? Here's what I see in my rails console:

 > $".select { |f| f =~ /mail_safe/ }
 => ["mail_safe/config.rb", "mail_safe/address_replacer.rb", "mail_safe/rails3_hook.rb", "mail_safe.rb"]

($" is an array containing all files that have been required).

@magpieuk
@myronmarston

What does this show in your console?

> Mail.send(:class_variable_get, '@@delivery_interceptors')
 => [MailSafe::MailInterceptor]

I'm thinking that maybe something is clearing the interceptors registered with Mail, including mail_safe. that would explain it not working.

@magpieuk

Thanks for taking the time with this myron.

Looks the same to me

Mail.send(:class_variable_get, '@@delivery_interceptors')
[MailSafe::MailInterceptor]

If you can do a simple test from a clean app and the problem is not there then it must be an issue with my config. I wasnt saying it was a problem, just I needed a second pair of eyes.

@jjconti
Collaborator

I tested it form rails console and works as expected.

@jjconti jjconti closed this Sep 5, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment