Closed dpaluy closed 1 year ago
The following solution resolved the issue:
new_mail.attachments.each do |attachment|
attachment.body = attachment.body.decoded
attachment.body_encoding = "binary"
end
However, I don't understand why we need explicitly change the encoding and can't reuse the current one.
I have a
Mail::Message
that I received with ActionMailbox. This message has an attachment PDF.I want to forward it to another address. But when I send it, it does additional encoding of the attached file, and the PDF is broken in the recipient mailbox.
The result is a broken PDF, because the attachment is Base64. (If I decode Base64, I receive correct PDF)
The only solution that works for me is:
But this one adds a new file, and the recipient gets 2 attachments (1 broken and 1 correct)
What is the correct way to forward the email with attachments?
Thank you