Mail gem - how to clean up the body string

前端 未结 4 1870
失恋的感觉
失恋的感觉 2021-02-05 19:06

I\'m trying to read an email using ruby mail gem. But mail.body.decoded returns me not just the body message. How can I clean up this body message and remove unwan

4条回答
  •  长情又很酷
    2021-02-05 19:45

    With the mail gem, you can do:

    text = mail.multipart? ? mail.text_part.decoded : mail.body.decoded`
    

提交回复
热议问题