Designer
Designer

Reputation: 1111

Rails 6 + ActionMailbox (mail.decoded) fails with emoji any other unexpected inputs

I'm trying to get plain simple text (no HTML) from email.

It works when I send email with plain text such as "hey this works fine"

It doesn't work when I include an emoji in the email body and it gives the error below in logs.

ActionMailbox::RoutingJob (Job ID: c9ca878b-) from Async(default) in 32.86ms: 
NoMethodError (Can not decode an entire message, try calling #decoded on the various fields and body or parts if it is a multipart message.):

My code is very simple:

I'm using mail.decoded is there any other function I can use with decoded to strip any unwanted character maybe

def process
        category.posts.create(user: user, cat_id: @cat.id, body: mail.decoded)
      end

Upvotes: 5

Views: 291

Answers (0)

Related Questions