It would be nice to have mail interceptor be able to modify the message to prevent delivery. Alternatively it would be nice to also prevent delivery in the mailer itself.
The use cases are as follows:
As such you could do each by wrapping more code around the MyMailer.mail_action(args)/.deliver pattern but it gets repetitive quickly.
This is not environment specific which is already handled very well in Rails since ages, this is more transactional. If we can already do this easily, feel free to point me to the right direction. Happy to send patch in due time if this is acceptable.
Possible routes i'm thinking are to add options to mail itself (:perform_delivery => determine_delivery(args)) and/or adding ability to prevent delivery from interceptor.
Suggestions/Ideas?
3. The email content may be spammy and you want to prevent that delivery
--
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/-/Xq3K3q2q4QIJ.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.
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.
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.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 placeof mail, which would decide based on your logic if mail must be calledor 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 rubyonrails-core@googlegroups.com.To unsubscribe from this group, send email to rubyonrails-core+unsubscribe@googlegroups.com.
On Friday, July 20, 2012 at 8:57 AM, Matthew Johnston wrote:
Try looking into a state machine. When the user confirms, then send an email. It's really easy to think about(guest) -- #confirm --> (confirming) -- #finished --> (active)before_transition :on => :confirm, :do => :send_confirmation_emailThen do some magic on the confirmation side that triggers the #finished event.Hope this helps
--
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/-/lxnPH9Phqn4J.
To post to this group, send email to rubyonra...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-co...@googlegroups.com.