Sam Kong
2011-Feb-28 18:44 UTC
How do I stop email from being delivered in the interceptor?
Hi, I am developing a rails 3 application. I want to use a interceptor before delivering emails. If a conditions meets, I want to stop the email. How do I do that? Thanks. Sam -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Colin Law
2011-Feb-28 20:20 UTC
Re: How do I stop email from being delivered in the interceptor?
On 28 February 2011 18:44, Sam Kong <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I am developing a rails 3 application. > I want to use a interceptor before delivering emails. > If a conditions meets, I want to stop the email. > How do I do that?When you say ''delivering'' emails do you mean ''sending''?. Is it the rails app that is sending the email? If so how is it initiating the send. Can you not just test the conditions before sending? Colin -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jim Ruther Nill
2011-Mar-01 00:21 UTC
Re: How do I stop email from being delivered in the interceptor?
On Tue, Mar 1, 2011 at 2:44 AM, Sam Kong <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Hi, > > I am developing a rails 3 application. > I want to use a interceptor before delivering emails. > If a conditions meets, I want to stop the email. > How do I do that? > >Have a look at the railscast for actionmailer in rails 3. The last part of the video is about intercepting the emails so it gets sent to the address you specify in your config.> Thanks. > > Sam > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Mark Nadig
2011-Mar-21 18:24 UTC
Re: How do I stop email from being delivered in the interceptor?
Sam Kong wrote in post #984511:> Hi, > > I am developing a rails 3 application. > I want to use a interceptor before delivering emails. > If a conditions meets, I want to stop the email. > How do I do that? > > Thanks. > > SamSam, did you get a solution with an interceptor? I tried returning false but the email is still delivered. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Leonid Shevtsov
2011-Apr-11 12:31 UTC
Re: How do I stop email from being delivered in the interceptor?
Sam Kong wrote in post #984511:> Hi, > > I am developing a rails 3 application. > I want to use a interceptor before delivering emails. > If a conditions meets, I want to stop the email. > How do I do that? > > Thanks. > > SamYou can throw an exception in the interceptor. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jaden C.
2011-Oct-12 18:28 UTC
Re: How do I stop email from being delivered in the interceptor?
I had the same problem, and stumbled upon this while reading the source code: class MailInterceptor def self.delivering_email(email) email.perform_deliveries= false end end -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Katie M.
2011-Nov-04 18:17 UTC
Re: How do I stop email from being delivered in the interceptor?
@jaden_c, I tried the "perform_deliveries = false" in my interceptor but the message still sends. class CANSPAMInterceptor def self.delivering_email(message) ...... message.perform_deliveries = false if message.to.size == 0 end end Is there something else I need to know? kt -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.