Skip to content

Instantly share code, notes, and snippets.

@alcabanillas-engh
Created November 25, 2008 15:57
Show Gist options
  • Save alcabanillas-engh/28952 to your computer and use it in GitHub Desktop.
Save alcabanillas-engh/28952 to your computer and use it in GitHub Desktop.
new_email = TMail::Mail.new
new_email.to = $config["smtp_config"]["to_address"]
new_email.subject = $config["smtp_config"]["subject"]
new_email.date = Time.now
new_email.set_content_type("multipart", "mixed")
new_email.mime_version = "1.0"
new_email.set_content_type("image", "tiff", "name" => "#{filename}.tiff")
new_email.header["Content-Disposition"] = "attachment; filename=" + "#{filename}.tiff"
new_email.body = fetched_email.body
#new_email.transfer_encoding = '7bit'
#new_email.body = "Here is your fax. \n\n" + fetched_email.body
#Then lets send it
Net::SMTP.start($config["smtp_config"]["server"], $config["smtp_config"]["port"]) do |smtpclient|
smtpclient.send_message(new_email.to_s, "ruby@presenceco.com", $config["smtp_config"]["to_address"])
end
puts 'Sent email @ ' + Time.now.to_s
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment