Class: MIME::Mail
- Inherits:
-
Object
- Object
- MIME::Mail
- Includes:
- Headers::Internet
- Defined in:
- lib/mime/mail.rb
Overview
Construct RFC 2822 Internet messages.
Constant Summary
Constants included from Headers::Internet
Headers::Internet::ATOM, Headers::Internet::DOT_ATOM, Headers::Internet::SPECIALS
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
Attributes included from Headers::Internet
#bcc, #cc, #comments, #date, #from, #in_reply_to, #keywords, #message_id, #references, #reply_to, #sender, #subject, #to
Instance Method Summary collapse
-
#initialize(content = nil) ⇒ Mail
constructor
Initialize a Mail object with body set to
content
. -
#to_s ⇒ Object
Format the Mail object as an Internet message.
Constructor Details
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
13 14 15 |
# File 'lib/mime/mail.rb', line 13 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
13 14 15 |
# File 'lib/mime/mail.rb', line 13 def headers @headers end |
Instance Method Details
#to_s ⇒ Object
Format the Mail object as an Internet message.
27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/mime/mail.rb', line 27 def to_s self.sender ||= sender_address self. ||= ID.generate_gid(domain) body.mime_version ||= "1.0 (Ruby MIME v#{VERSION})" #-- # In an RFC 2822 message, the header and body sections must be separated # by two line breaks (i.e., 2*CRLF). One line break is deliberately # omitted here so the MIME body supplier can append headers to the # top-level message header section. #++ "#{headers}\r\n#{body}" end |