File: mailfactory.rb

# mailfactory.rb

Path: | lib/mailfactory.rb
Last Update: | Tue Apr 07 01:02:42 -0600 2009

# Overview:

A simple to use module for generating RFC compliant MIME mail

# License:

Author: | David Powers
Copyright: | May, 2005
License: | Ruby License

# Usage:

      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)
      }

### Required files

pathname rubygems mime/types enumerator

[Validate]