5. Generate new mail
mail = Mail.new do
to "alice@example.com"
from "bob@example.com"
subject "Test mail"
body "This is a test mail"
end
puts mail.to_s
Date: Sun, 15 May 2016 14:10:34 +0900
From: bob@example.com
To: alice@example.com
Message-ID: <573804ca7b995_6788082dbf8745d3@gitorious.orz.cn.mail>
Subject:Test mail
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
This is a test mail
16 5 29
6. Parse new mail
mail = Mail.new(File.read(‘/path/to/mail’))
puts mail.to_s
Date: Sun, 15 May 2016 14:10:34 +0900
From: bob@example.com
To: alice@example.com
Message-ID:
<573804ca7b995_6788082dbf8745d3@gitorious.orz.cn.mail>
Subject:Test mail
Mime-Version: 1.0
Content-Type: text/plain;
charset=UTF-8
Content-Transfer-Encoding: 7bit
This is a test mail
16 5 29
7. mail
•
• Notes / Outlook RFC
• Syntax
•
•
• uuencode okkez PR
•
16 5 29
15. To get attachment files
• To get attachment files
mail.attachments
• readme ……
• HTML HTML
16 5 29
16. nested multipart
header part
Content-Type: multipart/mixed;
boundary="----
=_Part_2192_32400445.1115745999735"
multipart header
multipart header
multipart body
mail.parts << Mail::Part.new do
“This is multipart body”
end
mail.parts << Mail::Part.new do
part do
“This is nested multipart body”
end
end
Content-Type: text/plain;
boundary="--
==_mimepart_57387affe6d00_c2e8082dbf8514b
nested multipart
16 5 29