<nathanoleach-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2007-Apr-12 00:14 UTC
Re: Follow-Up: Receiving Inbound Email and Creating Data in
Julien, Thanks, I will probably end up with backgroundrb, which I have used in other situations with good results. I have just been trying to toy around and find something that would work and be a little more simple. Thanks to all for the help. Julien, post a followup with you results if time allows. Thanks, Nathan -----Original Message----- From: Julien Delgoulet <rails-mailing-list-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> Subj: [Rails] Re: Follow-Up: Receiving Inbound Email and Creating Data in Date: Wed Apr 11, 2007 2:34 pm Size: 1K To: rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org Nathan Leach wrote:> On Fri, 2007-04-06 at 18:47 -0400, Jason Edgecombe wrote: > >> environment in the config folder along with the database password. Then >> just use the value set by the environment. >> >> >> Sincerely, >> Jason >> > > Jason, > > Great points. I will move the settings to the config folder and try to > find another way to process the email body. > > I am considering the other two background email processing options. I > do have another idea to improve the current call to the Mailer model. > Not sure how feasible it is for production, but it seems to be working > in development ok. > > I was wondering about using a process fork to call the email > check/receive. Take a look at this code that would reside in the > application controller... > > if !session[:checked_mail] > Process.detach fork { > if Mailer.check_mail > session[:checked_mail] = true > end > } > end > > Would it alleviate the performance and/or scaling issues? Will this > cause problems? > > NathanHi nathan, May be you need to look to check backgroundrb and create a scheduled worker that will check for email every x minutes .. or hours ... I will have a try soon as I want my users to be able to upload photos by email ;-) Backgroundrb is here : http://backgroundrb.rubyforge.org/ Note that it can integrate with rails easily ;-) as long as you work on a unix machine. Happy rails coding everyone ! -- 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sai Emrys
2007-Apr-17 22:58 UTC
Re: Follow-Up: Receiving Inbound Email and Creating Data in
One suggestion: imap.search([''ALL'']).each do |message_id| msg = imap.fetch(message_id,''RFC822'')[0].attr[''RFC822''] envelope = imap.fetch(message_id, "ENVELOPE") [0].attr["ENVELOPE"] Mailman.receive(msg) #Mark message as deleted and it will be removed from storage when user session closd imap.store(message_id, "+FLAGS", [:Deleted]) end Then you shouldn''t need to delete separately. - Sai --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Nathan Leach
2007-Apr-17 23:41 UTC
Re: Follow-Up: Receiving Inbound Email and Creating Data in
On Tue, 2007-04-17 at 22:58 +0000, Sai Emrys wrote:> One suggestion: > > imap.search([''ALL'']).each do |message_id| > msg = imap.fetch(message_id,''RFC822'')[0].attr[''RFC822''] > envelope = imap.fetch(message_id, "ENVELOPE") > [0].attr["ENVELOPE"] > Mailman.receive(msg) > #Mark message as deleted and it will be removed from storage > when user session closd > imap.store(message_id, "+FLAGS", [:Deleted]) > end > > Then you shouldn''t need to delete separately. > > - Sai >Sai, Thanks, I will give this a try. I appreciate the help. Nathan --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---