There are cases when using “main” storage service for storing emails is undesirable – to name a few, regulatory compliance and ease of batch management of email uploads.
I propose that ActionMailbox can be configured to use a separate ActiveStorage service.
This looks like a good idea but I need to think about it some more. I’m wondering if it wasn’t configurable before how did people deal with this in production? Were they just overriding the behavior somehow?
@yrashk That’s a good point, but even existing users will have this problem until they can upgrade to a version of Rails that has your feature. Would you be willing to share your solution for those who can’t yet?
This is what I’ve done for production environment so far. It produces an overloading
warning (obviously) and doesn’t patch everything the PR does, but it does work in production
right now.
ActiveSupport.on_load(:action_mailbox_inbound_email) do
ActionMailbox::InboundEmail.class_eval do
has_one_attached :raw_email, service: :email_storage
end
end
I also had to move whatever email files I had from the original bucket to the new buckets and update the blobs table to refer to the new service name for those.