I have this script but currently it only send email to one recipient. Someone knows how to send email to multiple recipients? Please help. require ''ruport'' require ''ruport/util'' r = Ruport::Report.new r.add_mailer :default, :host => "mail.host.com", :address => "address-19nr15rzP4Y@public.gmane.org" r.send_to("to-19nr15rzP4Y@public.gmane.org") do |mail| mail.subject = "Test Report" mail.attach "test_file.txt" mail.text = "This is an email with attached txt" end Thanks!
help please.
Hi Marlon> require ''ruport'' > require ''ruport/util'' > > r = Ruport::Report.new > r.add_mailer :default, > :host => "mail.host.com", > :address => "address-19nr15rzP4Y@public.gmane.org" > > r.send_to("to-19nr15rzP4Y@public.gmane.org") do |mail| > mail.subject = "Test Report" > mail.attach "test_file.txt" > mail.text = "This is an email with attached txt" > endTry like recipients = ["to1-19nr15rzP4Y@public.gmane.org","to2-19nr15rzP4Y@public.gmane.org",....] recipients.each do |recipient| r.send_to(recipient) do |mail| mail.subject = "Test Report" mail.attach "test_file.txt" mail.text = "This is an email with attached txt" end end Sijo -- Posted via http://www.ruby-forum.com/.
Thanks for helping Sijo
Hi Marlon Another easy way also there. recipients = ["to1-19nr15rzP4Y@public.gmane.org","to2-19nr15rzP4Y@public.gmane.org",....] r.send_to(recipients) do |mail| mail.subject = "Test Report" mail.attach "test_file.txt" mail.text = "This is an email with attached txt" end Just test this Sijo -- Posted via http://www.ruby-forum.com/.
> Try like > recipients = ["t...-19nr15rzP4Y@public.gmane.org","t...-19nr15rzP4Y@public.gmane.org",....] > recipients.each do |recipient| > r.send_to(recipient) do |mail| > mail.subject = "Test Report" > mail.attach "test_file.txt" > mail.text = "This is an email with attached txt" > end > endSo, I''m guessing that something like the following could also be done: Mailinglist.find(:all).each do |ml_record| r.send_to(ml_record.address) blah blah Would this be the appropriate way to handle a mailing list? Is there some other way I should consider? If we get a few thousand addresses returned, is that going to be a problem? Thanks. ... doug