title: How to Easily Process IMAP Email in RAILS 6
body: <p>I am looking for an easy way to parse an IMAP struct that I have read from an exiting email account. Ideally if you could point me to an existing gem that handles imap emails. Everything I find is extremely old.</p>
  
  <p>My app fetches email from an existing, external imap account. I am able to read the email and retrieve it and even to parse it and extract most  of the information I want. However, I am not able to extract the HTML or text body parts easily. Overall, parsing the struct that is returned by the net/imap library is difficult to handle. </p>
  
  <p>All the help articles that I can find on the topic seem VERY old and existing gems have not been updated in many years. </p>
  
  <p>Is there not an easy way, a gem or built in library to handle imap objects? I am also open t rewriting my app to do things easier. My code below is workig fine. The envelopes struct that I receive back is just really awful to work with.</p>
  
  <pre><code>      connection = Net::IMAP.new(server.inbound_server, server.inbound_port, server.inbound_encryption)
        connection.login(server.inbound_user, server.inbound_password)
  
        connection.examine("INBOX")
        uid_list = connection.search(["FROM", search_term])
        envelopes = connection.fetch(uid_list, "ENVELOPE")
  </code></pre>