i need to send massive emails to various customers, here 2 solutions i have think: 1- customers = Customer.find(:all, :conditions => "newsletter = 1") customers.each do |c| @email = c.email Mailer.deliver_send_newsletter(@subject, @email, @notice_id) end 2- customers = Customer.find(:all, :conditions => "newsletter = 1") customers.each do |c| addresses << c.email+", " end @emails=addresses.join.gsub(/(, )$/, '''') Mailer.deliver_send_newsletter(@subject, @emails, @notice_id) what is the right solution ? -- Posted via http://www.ruby-forum.com/.
On Aug 20, 2009, at 1:51 PM, Aldo Italo wrote:> > i need to send massive emails to various customers, > here 2 solutions i have think: > > > 1- > > customers = Customer.find(:all, :conditions => "newsletter = 1") > customers.each do |c| > @email = c.email > Mailer.deliver_send_newsletter(@subject, @email, @notice_id) > end > > > 2- > customers = Customer.find(:all, :conditions => "newsletter = 1") > customers.each do |c| > addresses << c.email+", " > end > @emails=addresses.join.gsub(/(, )$/, '''') > Mailer.deliver_send_newsletter(@subject, @emails, @notice_id) > > > what is the right solution ?Hard to say without knowing how many customers that query is going to return... if it''s under a 100 it doesn''t matter. Under a 1000 it probably doesn''t matter. If it''s 10,000 and it''s once a week, neither is going to be very fun. Keep in mind that those queries will instantiate however many objects that match... you could suck up a lot of memory... at least use the new find/block stuff. Might want to look into ar_mailer (ruby stuff), bulk_mailer (stand alone) and if your volume is high one of the companies that does this for a living so you don''t have to deal with ending up on aol/msn/ yahoo''s spam blacklists... -philip
> Hard to say without knowing how many customers that query is going to > return... if it''s under a 100 it doesn''t matter. Under a 1000 it > probably doesn''t matter.i have under 500 customers> of memory... at least use the new find/block stuff.what is it? thanks -- Posted via http://www.ruby-forum.com/.
>> Hard to say without knowing how many customers that query is going to >> return... if it''s under a 100 it doesn''t matter. Under a 1000 it >> probably doesn''t matter. > > i have under 500 customersIf it were me I''d email them each individually and customize the email to include their full name in the to field, a "hello Aldo" in the message, and a one-click unsubscribe url. Doesn''t matter how you send them with only 500.>> of memory... at least use the new find/block stuff. > > what is it?I can never remember the exact syntax... it''s a new method that lets you issue a find and then iterate through it say 100 objects at a time -- so that you aren''t building an array of 10,000 objects. Google around and you''ll find it. -philip
I''ve googled a bit and I can''t seem to find it. Could you do me a huge favor and link me?! On Thu, Aug 20, 2009 at 5:34 PM, Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> wrote:> > >> Hard to say without knowing how many customers that query is going to > >> return... if it''s under a 100 it doesn''t matter. Under a 1000 it > >> probably doesn''t matter. > > > > i have under 500 customers > > If it were me I''d email them each individually and customize the email > to include their full name in the to field, a "hello Aldo" in the > message, and a one-click unsubscribe url. Doesn''t matter how you send > them with only 500. > > > >> of memory... at least use the new find/block stuff. > > > > what is it? > > I can never remember the exact syntax... it''s a new method that lets > you issue a find and then iterate through it say 100 objects at a time > -- so that you aren''t building an array of 10,000 objects. Google > around and you''ll find it. > > -philip > > > >--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
On Aug 20, 2009, at 2:46 PM, James Englert wrote:> I''ve googled a bit and I can''t seem to find it. Could you do me a > huge > favor and link me?!find_each is what it''s called... http://github.com/rails/rails/blob/106976df0911e423042ec4abc165fd561766a047/activerecord/lib/active_record/batches.rb#L47 -philip> On Thu, Aug 20, 2009 at 5:34 PM, Philip Hallstrom <philip-LSG90OXdqQE@public.gmane.org> > wrote: > >> >>>> Hard to say without knowing how many customers that query is >>>> going to >>>> return... if it''s under a 100 it doesn''t matter. Under a 1000 it >>>> probably doesn''t matter. >>> >>> i have under 500 customers >> >> If it were me I''d email them each individually and customize the >> email >> to include their full name in the to field, a "hello Aldo" in the >> message, and a one-click unsubscribe url. Doesn''t matter how you >> send >> them with only 500. >> >> >>>> of memory... at least use the new find/block stuff. >>> >>> what is it? >> >> I can never remember the exact syntax... it''s a new method that lets >> you issue a find and then iterate through it say 100 objects at a >> time >> -- so that you aren''t building an array of 10,000 objects. Google >> around and you''ll find it. >> >> -philip >> >>> >> > > >
Are desktop email address software products worth the money? Perhaps some are, but it''s important to know what to expect when you buy a license. If you are expecting 100% accuracy, this can never be achieved with email address validation software. However, if you are looking for the best possible accuracy, you need to be aware that desktop software simply can''t deliver good results.Are you looking for more information about the new list <a href="http://www.massmailingnews.com/">bulk email mailer</a>............ -- 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.
On 10 December 2010 06:41, Samd Onna <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> Are desktop email address software products worth the money? <snip spam>Are these messages supposed to be ironic? -- 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.