Class: SendGmail::Objects::Mail
- Inherits:
-
Object
- Object
- SendGmail::Objects::Mail
- Defined in:
- lib/send_gmail/objects/mail.rb
Instance Attribute Summary collapse
-
#bcc ⇒ Object
Returns the value of attribute bcc.
-
#body ⇒ Object
Returns the value of attribute body.
-
#cc ⇒ Object
Returns the value of attribute cc.
-
#date ⇒ Object
Returns the value of attribute date.
-
#from ⇒ Object
Returns the value of attribute from.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ Mail
constructor
A new instance of Mail.
- #to_raw_data ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ Mail
Returns a new instance of Mail.
7 8 9 10 11 |
# File 'lib/send_gmail/objects/mail.rb', line 7 def initialize(params = {}) params.each do |key, value| instance_variable_set("@#{key}", value) end end |
Instance Attribute Details
#bcc ⇒ Object
Returns the value of attribute bcc.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def bcc @bcc end |
#body ⇒ Object
Returns the value of attribute body.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def body @body end |
#cc ⇒ Object
Returns the value of attribute cc.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def cc @cc end |
#date ⇒ Object
Returns the value of attribute date.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def date @date end |
#from ⇒ Object
Returns the value of attribute from.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def from @from end |
#subject ⇒ Object
Returns the value of attribute subject.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
5 6 7 |
# File 'lib/send_gmail/objects/mail.rb', line 5 def to @to end |
Instance Method Details
#to_raw_data ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/send_gmail/objects/mail.rb', line 13 def to_raw_data msg = body.to_s from_text = from to_text = to subject_text = subject mail = ::Mail.new do from from_text to to_text subject subject_text body msg end raw = mail.to_s raw = "Bcc:#{bcc}\r\n#{raw}" unless bcc.nil? raw = "Cc:#{cc}\r\n#{raw}" unless cc.nil? raw end |