To install ruport via rubygems:
sudo gem install ruport
Check to see if it installed properly: ruby -rubygems -e "require 'ruport'; puts Ruport::VERSION"
To use:
require 'ruport'
require 'ruport/util'
r = Ruport::Report.new
r.add_mailer :default,
:host => "mail.domain.com",
:address => "email@domain.com"
recipients = ["to1@domain.com","to2@domain.com"]
recipients.each do |recipient|
r.send_to(recipient) do |mail|
mail.subject = "Test Email"
mail.attach "test_file.txt"
mail.attach "stylesheet.xsl"
mail.text = "This is an email with attachments"
end
end
No comments:
Post a Comment