Ruport-how to send email to multiple recipients

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 => “[email protected]

r.send_to(“[email protected]”) 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 => “[email protected]

r.send_to(“[email protected]”) do |mail|
mail.subject = “Test Report”
mail.attach “test_file.txt”
mail.text = “This is an email with attached txt”
end

Try like
recipients = [“[email protected]”,“[email protected]”,…]
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

Hi Marlon
Another easy way also there.

recipients = [“[email protected]”,“[email protected]”,…]
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

Thanks for helping Sijo