How to save ActionMailbox inbound HTML emails and attachments with ActionText and ActiveStorage Discussion
Firstly, thanks for this. It has been very useful and saved me a heck of a lot of time. I do have one specific question. In app/mailboxes/post.rb should line 11 not read:
@_attachments ||= mail.attachments.map do |attachment|
As I read the code at the moment, the map loop in method
attachments gets executed twice: once via the call to
body to extract the embedded images etc and a second time directly from
process. This in turn means that every attachment is saved twice in the database.
Hey Chris, Thanks for this screencast! There aren't a whole lot of Action Mailbox tutorials out there and this is one of the best.
One very minor improvement: When building ActiveStorage blobs out of attachments, you can simply use
attachment.decoded instead of
attachment.body.to_s, as seen in the mail readme :)