talira

Mail (Ruby)

Pure-Ruby library for generating, parsing and sending email

open sourceMITfree

Mail is a pure-Ruby library for generating, parsing and sending email, built from its author's experience with TMail. It reads and writes RFC 5322 email, reads UTF-8 headers (RFC 6532), handles multipart MIME email (RFC 2045 to 2049) including multipart/alternative and multipart/report messages, and auto-encodes non-ASCII bodies and header fields. Network actions go through wrappers for Net::SMTP, Net::POP3 and files. It's the mail gem.

Problems it solves

  • build a multipart email with text and HTML parts in Ruby
  • parse incoming email messages in Ruby
  • send email over SMTP from a Ruby script

Features

  • read and write RFC 5322 email; read UTF-8 headers (RFC 6532)
  • multipart MIME email (RFC 2045 to 2049), including text and HTML alternatives
  • read multipart/report messages and their details
  • send and receive through Net::SMTP, Net::POP3 and file wrappers
  • auto-encoding of non-US-ASCII bodies and header fields
  • skips headers it doesn't understand instead of failing

Limitations

  • It parses US-ASCII and UTF-8 email but generates US-ASCII email, and some obsolete email syntax gives it problems.1