Last Modified
2012-07-30 16:50:09 +0000
Requires
  • pathname
  • rubygems
  • mime/types
  • enumerator

Description

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