Class: LeanMail::Data
- Inherits:
-
Object
- Object
- LeanMail::Data
- Defined in:
- contrib/lib/lean_mail.rb
Overview
RFC 2821 message data representation.
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
-
#subject ⇒ Object
readonly
Returns the value of attribute subject.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(from, to, subject, message) ⇒ Data
constructor
A new instance of Data.
- #to_s ⇒ Object
Constructor Details
#initialize(from, to, subject, message) ⇒ Data
Returns a new instance of Data.
37 38 39 40 41 42 |
# File 'contrib/lib/lean_mail.rb', line 37 def initialize(from, to, subject, ) @from = from @to = to @subject = subject @message = end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
35 36 37 |
# File 'contrib/lib/lean_mail.rb', line 35 def from @from end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
35 36 37 |
# File 'contrib/lib/lean_mail.rb', line 35 def @message end |
#subject ⇒ Object (readonly)
Returns the value of attribute subject.
35 36 37 |
# File 'contrib/lib/lean_mail.rb', line 35 def subject @subject end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
35 36 37 |
# File 'contrib/lib/lean_mail.rb', line 35 def to @to end |
Instance Method Details
#to_s ⇒ Object
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'contrib/lib/lean_mail.rb', line 44 def to_s <<~MAIL Content-type: text/plain; charset=UTF-8 From: #{@from} To: #{to.instance_of?(Array) ? to.join(', ') : to} Subject: =?UTF-8?B?#{Base64.strict_encode64(subject)}?= Date: #{Time.new.rfc2822} Message-Id: <#{SecureRandom.uuid}@#{Socket.gethostname}> #{@message} MAIL end |