Class: Sunabamail::Mail
- Inherits:
-
Object
- Object
- Sunabamail::Mail
- Defined in:
- app/models/sunabamail/mail.rb
Instance Method Summary collapse
- #attachments ⇒ Object
- #has_html? ⇒ Boolean
- #has_text? ⇒ Boolean
- #html_body ⇒ Object
-
#initialize(raw) ⇒ Mail
constructor
A new instance of Mail.
- #text_body ⇒ Object
Constructor Details
Instance Method Details
#attachments ⇒ Object
38 |
# File 'app/models/sunabamail/mail.rb', line 38 def = . |
#has_html? ⇒ Boolean
12 13 14 15 16 |
# File 'app/models/sunabamail/mail.rb', line 12 def has_html? return true if html_part.present? "text/html" == content_type end |
#has_text? ⇒ Boolean
6 7 8 9 10 |
# File 'app/models/sunabamail/mail.rb', line 6 def has_text? return true if text_part.present? "text/plain" == content_type end |
#html_body ⇒ Object
28 29 30 31 32 33 34 35 36 |
# File 'app/models/sunabamail/mail.rb', line 28 def html_body if multipart? part = html_part body = part.body body.to_s.force_encoding(part.charset) elsif "text/html" == content_type body.to_s.force_encoding(.charset) end end |
#text_body ⇒ Object
18 19 20 21 22 23 24 25 26 |
# File 'app/models/sunabamail/mail.rb', line 18 def text_body if multipart? part = text_part body = part.body body.to_s.force_encoding(part.charset) elsif "text/plain" == content_type body.to_s.force_encoding(.charset) end end |