mailfactory.rb

Path: lib/mailfactory.rb
Last Update: Fri Aug 07 19:30:36 +0000 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]