Conversation
41f6816 to
314ddff
Compare
975a78c to
f524af8
Compare
314ddff to
604cb99
Compare
Integrate ActionMailbox into `RequestMailer.receive` for inbound email handling. This maintains existing functionality but lays the groundwork for future enhancements. Benefits of using ActionMailbox include: 1. Enhanced email routing capabilities, enabling specialised processing like the Excel hidden data spreadsheet analyzer. 2. Refactoring opportunities for `RequestMailer#receive`, particularly for spam detection, duplicate email handling, and initial request assessment. 3. Clear separation of concerns between Mailers (for sending) and Mailboxes (for receiving). 4. Improved email processing efficiency through ActionMailbox, facilitating background job handling and potential simplification of mail ingress. 5. Provides a solution for re-users to receive emails without needing their own mail server setup.
Include options for ActionMailbox supported services in the retriever method and set the ingress setting.
Instead of calling inline extract into a method so we can call later in the install script after bundle install has been run. This is so we can set the ingress password in the Rails credentials needed for the ActionMailbox migration.
Set credentials and correctly configure Postfix pipe to use ActionMailbox ingress with the correct password.
Ensure encrypted credentials and private key aren't committed into the repo. Normally for Rails it is acceptable for the encrypted credentials to be committed but given Alaveteli powers multiple sites we don't want this.
604cb99 to
ad69c8c
Compare
Move test to higher level allowing us rollback the fix in #5867 as this won't been needed in the future when emails are stored in ActiveStorage before processing. This will allow us to use ActionMailbox's `Mail.from_source` extension.
Use `Mail.from_source` from ActionMailbox. Both method do the same thing so this is a straight swap. Allows us to call `#mail` on the ActionMailbox::InboundEmail instance in the RequestMailbox.
garethrees
left a comment
There was a problem hiding this comment.
Nice, so much cleanup in all of this 🙌
| See: https://github.com/mysociety/alaveteli/wiki/ActionMailbox-Migration-Guide | ||
|
|
||
| * _Required:_ After ActionMailbox migration please backup `config/master.key`. | ||
| This file gets generated automaticaally and is the private encryption key for |
There was a problem hiding this comment.
typo: /automaticaally/automatically/
| * _Required:_ After ActionMailbox migration please backup `config/master.key`. | ||
| This file gets generated automaticaally and is the private encryption key for | ||
| the credentials. Without it the application can't read credentials. If you | ||
| ever move servers or reinstall Alaveteli then you might need this file. |
There was a problem hiding this comment.
/might/will/?
Might be worth linking to the upstream rails guides here (https://guides.rubyonrails.org/security.html#custom-credentials I think is the main guide but not super familiar with this)
|
|
||
| * _Required:_ Please update your `config/storage.yml` file to include a | ||
| production configuration for `inbound_emails`. See | ||
| `config/storage.yml-example` as an example. |
There was a problem hiding this comment.
Would it make sense to set filesystem-based as the default? I expect that will be what most start with.
spec/support/email_helpers.rb
Outdated
| end | ||
|
|
||
| def get_fixture_mail(filename_or_string, email_to = nil, email_from = nil) | ||
| def get_fixture_mail(filename_or_string, email_to: nil, email_from: nil) |
There was a problem hiding this comment.
Could make these just to: nil, from: nil as its fairly obvious these are about the mail headers?
| content.gsub!('EMAIL_ENVELOPE_TO', kwargs[:email_envelope_to]) | ||
| end | ||
| content | ||
| kwargs.slice(*%i[email_to email_from email_cc email_bcc email_envelope_to]). |
There was a problem hiding this comment.
Similarly could remove the email_ prefix from the kwargs to make method calls shorter.
Relevant issue(s)
Fixes #8801
What does this do?
Adds the ability to receive email via ActionMailbox.
Why was this needed?
Removing custom mail handling code and switching to the Rails-way