lib/paubox/mail_to_message.rb in paubox-0.1.0 vs lib/paubox/mail_to_message.rb in paubox-0.1.1
- old
+ new
@@ -32,11 +32,13 @@
def build_content
content = {}
if mail.multipart?
html_content = mail.html_part.body.to_s if mail.html_part
text_content = mail.text_part.body.to_s if mail.text_part
- content[:html_content] = html_content unless html_content.empty?
- content[:text_content] = text_content unless text_content.empty?
+ content[:html_content] = html_content unless html_content.nil?
+ content[:text_content] = text_content unless text_content.nil?
+ elsif mail.content_type.to_s.include? 'text/html'
+ content[:html_content] = mail.body.to_s
else
content[:text_content] = mail.body.to_s
end
content
end