@schneems Thanks!

Seems you cant prevent deliveries from interceptor as yet. I understand 
that checking on the user model before delivering is always going to be 
hard/unclean from interceptor (how is the interceptor going to get hold of 
the user model anyway?) but preventing deliveries from interceptors 
shouldnt be.

I still havent thought how I can cleanly prevent all deliveries to some 
users use case but at the very least I could flag them in each mailer 
action where the mail is being sent. Another way I'm thinking this could be 
prevented is to override the "email" reader in the user model and return an 
address that could help the interceptor prevent delivery.


On Thursday, 19 July 2012 21:38:33 UTC+5:30, richard schneeman wrote:
>
> Having the ability to easily comply to CAN-spam and other email 
> legislation without having to add an if clause to _everywhere_ you are 
> sending out email would be nice. 
>
> Looks like you can already do something like this a mail interceptor: 
> http://stackoverflow.com/questions/8594626/how-to-add-a-before-filter-in-usermailer-which-checks-if-it-is-ok-to-mail-a-user,
>  
> though the OP never responded whether that works or not. 
>
>
>
> -- 
> Richard Schneeman
> http://heroku.com
> @schneems <http://twitter.com/schneems>
>
> On Thursday, July 19, 2012 at 10:43 AM, Thibaut Barrère wrote:
>
> Hi,
>
> I met the same need (eg: to avoid sending any email until the user is
> "confirmed" for instance) but did not implement anything yet.
>
> I would probably just create a custom_mail method to be used in place
> of mail, which would decide based on your logic if mail must be called
> or not.
>
> That said having a "global" hook to stop delivery could be useful too.
>
> Just a thought!
>
> -- Thibaut
>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Core" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to 
> [email protected].
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-core?hl=en.
>
>  
> 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Core" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-core/-/5DuGKZjaaaoJ.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-core?hl=en.

Reply via email to