Path: | lib/mailfactory.rb |
Last Update: | Wed Aug 27 10:38:57 -0600 2008 |
A simple to use module for generating RFC compliant MIME mail
Author: | David Powers |
Copyright: | May, 2005 |
License: | Ruby License |
require 'net/smtp' require 'rubygems' require 'mailfactory' mail = MailFactory.new() mail.to = "test@test.com" mail.from = "sender@sender.com" mail.subject = "Here are some files for you!" mail.text = "This is what people with plain text mail readers will see" mail.html = "A little something <b>special</b> for people with HTML readers" mail.attach("/etc/fstab") mail.attach("/some/other/file") Net::SMTP.start('smtp1.testmailer.com', 25, 'mail.from.domain', fromaddress, password, :cram_md5) { |smtp| mail.to = toaddress smtp.send_message(mail.to_s(), fromaddress, toaddress) }