Skip to main content
Ask A Question
You’re not receiving notifications from this thread.

How to save ActionMailbox inbound HTML emails and attachments with ActionText and ActiveStorage Discussion

General • Asked by Chris Oliver

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 ||= 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 :)

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 30,005+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.