I’m using the mail gem from https://github.com/mikel/mail
I use it to parse raw mail data: e.g
require 'mail'
maildata = Mail.new(body) #where body is the raw text of an email message
#from there I can see info such as
p maildata.body.decoded #displays the decoded email body
p maildata.from #shows who the email is from
How would I figure out whether the email is plaintext or html is there a built in way to do this?
You could look at
maildata.content_type:If it’s a multipart e-mail, you could have both plain text and HTML. You could then look at the
partsarray to see which content types it includes: