Sending an email with attachment file

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • littlemaster
    New Member
    • Apr 2010
    • 25

    Sending an email with attachment file

    The following program will send the mail with specified attachment file.Need to give the absolute path of the file.

    require "rubygems"
    require "ruport"
    require "ruport/util"

    r = Ruport::Report. new

    r.add_mailer :default,
    :host => "192.168.1. 1",
    :address => "xxxx@bksys.co. in"

    r.send_to("xxxx @bksys.co.in") do |mail|
    mail.subject = "Hello"
    mail.attach "foo.csv"
    mail.text = "This is an email with attached csv file using ruport"
    end
Working...