Email on Rails
Allen Fair
BIGLIST Inc.
Philly on Rails
August 6, 2007
Email in Rails
ActionMailer
Creates Email
Messages
Invokes SMTP or
Sendmail for
delivery
Receives Email
Messages for
processing
Includes updated
TMail library
TMail
Constructs action
messages
(outgoing)
Parses messages
(incoming)
Accesses, traverses
parts/attachments,
headers, etc.
Supports most
RFC822 and MIME
standards
Email Review
Mail User Agent (MUA)
Reading and Composition
Mail Transport Agent (MTA)
Queuing & Delivery
Email
Envelope – Of Interest to your MTA
Return Path – Specfies source/bounce address
Recipients – List of addresses to receive the email
Message – Of interest to your MUA
Headers
Simple Body or MIME Multipart Container
Attachments and Body Parts
Email Headers
From: User Name <user1@example.com>
To: User Name <user2@example.com>
Reply-To: <user3@example.com>
Subject: [PhillyOnRails] Email on Rails Talk
Date: Sat, 04 Aug 2007 14:43:01 -0400
Content-Type: text/plain
Received: from smtp.x.com by mail.y.com ...
X-*:
Three Ways Home
From: allen@example.com ”Allen”
Default ”reply to” address
Matches address book for ”safe list”
Displayed to user
Reply-To: fair@example.com
Overrides ”from” address
Return Path: bounce-user=x.com@y.com
Used by MTA to authenticate sender and
returned bounced emails
Not used or seen by most mail clients
Variable Envelope Return Path (VERP)-Friendly
Simple text/plain email
From: <sender@example.com>
To: <recipient@example.com>
Subject: Text is plain
Date: Tue, 5 Jun 2007 05:58:03 -0400
This is a plain text email.
MIME Types
text/plain
text/html
multipart/alternative
image/jpeg
multipart/mixed
multipart/related
Stir to combine...
Complex Email Message
multipart/mixed – Body and attachments
multipart/alternative – Versions for
viewing
text/plain – Text version of email body
multipart/related – References
positioned images (within HTML body)
text/html