Commit Graph

41 Commits

Author SHA1 Message Date
Rafael Mendonça França
18707ab17f
Standardize nodoc comments 2021-07-29 21:18:07 +00:00
David Jones
c6c53a02a5 Permit attachments in mailbox conductor params
Prior to this commit, when adding attachments to an inbound email
through the conductor, the log would warn of an unpermitted parameter
with the message:

> Unpermitted parameter: :attachments. Context: { }

Also, if an application had the setting:

  config.action_controller.action_on_unpermitted_parameters = :raise

it would raise an error, because the attachments are not a permitted
parameter.

This commit also sets `action_on_unpermitted_parameters` to `:raise`
for the action mailbox test suite, so that tests are run in most
restrictive setting available, to prevent future unpermitted parameters
from being passed by conductor actions.

Co-authored-by: Dana Henke <danapalazzo1@gmail.com>
2021-07-02 16:56:16 -04:00
Andrew White
f263530bf7
Merge pull request #42634 from HackerIntro/actionmailbox-storage-service
Problem: ActionMailbox uses default ActiveStorage service
2021-07-01 16:15:37 +01:00
Yurii Rashkovskii
855e08d22d Problem: ActionMailbox uses default ActiveStorage service
This is imperfect in situations when a separation
between regular files (such as uploads) and emails
is necessary (for the purposes of regulatory compliance,
proper compartmentalization, etc.)

Solution: allow configuring ActionMailbox's storage service
2021-06-30 09:33:29 -07:00
Dirkjan Bussink
0523532a3c
Always use OpenSSL constants for Digest operations
As also previously discussed in
https://github.com/rails/rails/pull/40770#issuecomment-748347066, this
moves the usage of Digest constants to always use the OpenSSL version of
those Digest implementations.
2021-06-30 13:57:54 +02:00
Santiago Bartesaghi
75e6ea4756 Implement ActionMailbox incinerate in conductor 2021-06-24 15:35:56 -03:00
Rafael Mendonça França
1b455e2e9d
Rails 6.2 is now Rails 7.0
We have big plans for the next version of Rails and that
require big versions.
2021-02-04 16:47:16 +00:00
Yasuo Honda
51931f0bde Address Rails 7.0 will return Content-Type header without modification
This pull request addresses these warnings.

```ruby
$ cd actionmailbox
$ bin/test test/controllers/ingresses/relay/inbound_emails_controller_test.rb
Run options: --seed 32561

DEPRECATION WARNING: Rails 7.0 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead. (called from call at /home/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15)
...DEPRECATION WARNING: Rails 7.0 will return Content-Type header without modification. If you want just the MIME type, please use `#media_type` instead. (called from call at /home/yahonda/.rbenv/versions/3.0.0/lib/ruby/gems/3.0.0/gems/rack-2.2.3/lib/rack/tempfile_reaper.rb:15)
..

Finished in 0.114883s, 43.5224 runs/s, 87.0447 assertions/s.
5 runs, 10 assertions, 0 failures, 0 errors, 0 skips
$
```

Follow-up https://github.com/rails/rails/commit/84055130713
related to https://github.com/rails/rails/pull/41251
2021-02-02 20:18:03 +09:00
George Claghorn
22f3dfe3cb
Upload raw email before creating pending ActionMailbox::InboundEmail
Fix that a storage upload error would leave behind a stuck-pending ActionMailbox::InboundEmail that could never be processed. The message isn't lost: the SMTP relay sees an HTTP server error and defers message delivery. We just have spurious, non-actionable InboundEmails stuck pending and tripping monitoring.

This does still leave behind an unattached ActiveStorage::Blob with no corresponding object on the storage service, but that's less annoying.
2021-01-04 09:28:09 -05:00
George Claghorn
11738e82cd Extract ActionMailbox::Record
Permit applications to hack in custom DB config for ActionMailbox::InboundEmail until Action Mailbox has first-class multi-DB support:

ActiveSupport.on_load(:action_mailbox_record) do
  connects_to reading: :action_mailbox_replica, writing: :action_mailbox_primary
end
2020-09-29 11:59:14 -04:00
Mark Haussmann
71c8a89edd
Sendgrid: prepend X-Original-To header with envelope recipients
Sendgrid, like Mailgun, only passes BCC recipients as a parameter in the original JSON payload.

This PR adds code to prepend the recipients from the Sendgrid payload to the raw_email under the X-Original-To header.

References #38738.
2020-07-21 19:38:38 -04:00
Chris Oliver
12afb7fb4b
Allow passing URL params to conductor form for inbound emails 2020-07-14 14:02:43 -04:00
David Heinemeier Hansson
666947089d Add option to set X-Original-To for systems that route on envelope addressing 2020-04-13 15:14:53 -07:00
Bill Cromie
fce29be335 Add a route to handle Mandrill's webhook URL check
Mandrill's Inbound API checks to see if a URL exists before it creates
the webhook. It sends a HEAD request, to which we now return a 200 OK
response to indicate that the route exists.

Now we can generate inbound API calls with ease on Mandrill, without
having to shuffle around tokens in production.

Fixes #37609.
2020-04-07 13:22:36 +01:00
David Heinemeier Hansson
d56d2e7406
Add a way to deliver inbound emails by source (#38849)
* Add a way to deliver inbound emails by source

Great for testing when you get an eml file and can just paste it in.

* Test updates

* Fix tests

* Fix spacing
2020-03-31 16:46:13 -07:00
Rikki Pitt
667d69cc5b
Add X-Original-To to mail using Mailgun recipient (#38738)
Expose the Mailgun SMTP recipient to Action Mailbox as X-Original-To, like Postfix.

Allows handling BCCed recipients who aren't listed in To/CC fields.
2020-03-23 18:10:48 -07:00
Matthijs Vos
8dca5162f9
Replace Mailgun API key with signing key
Mailgun now needs the signing key instead of the API key for validating incoming mails.
2020-02-21 11:33:04 -05:00
Haroon Ahmed
db1ae8cbb4 remove reference to global rails command and replace with bin/rails 2019-12-27 19:32:37 +00:00
Takayuki Nakata
fffb2b2a11 Fix typo in ActionMailbox::InboundEmail::MessageId [ci skip]
- `a Active Storage` -> `an Active Storage`
- `which be uploaded` -> `which is uploaded`
2019-09-17 17:40:49 +09:00
Kyle Keesling
ce88f6bd25
Fix filenames of attachments created via the inbound email conductor
controller passed along attachment file paths instead of their filenames
2019-07-25 21:11:29 -04:00
yuuji.yaginuma
aab9f6734d Include BCC in the mail that sent from the development page
The BCC should be included as we show input field for BCC in view.
bf625f7fec/actionmailbox/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb (L21-L24)
2019-06-20 14:09:01 +09:00
George Claghorn
f480cfabcd
Remove the Amazon SES ingress
It's unusable and not ready to ship in Rails 6.0. We'll rewrite it for 6.1.
2019-04-14 12:15:54 -04:00
yuuji.yaginuma
1b2f1735e7 Fix loading ActionMailbox::BaseController when CSRF protection is disabled
When `default_protect_from_forgery` is false, `verify_authenticity_token`
callback does not define and `skip_forgery_protection` raise exception.

Fixes #34837.
2019-04-11 18:25:09 +09:00
Pratik
d0037daa37 Allow skipping incineration of processed emails 2019-02-06 19:28:49 -05:00
alkesh26
b8e0333845 enclosing body tag in conductor layout. 2019-01-20 00:58:06 +05:30
Yuichi Takeuchi
88453093d5 Fix that adding attachments lose a body 2019-01-19 23:28:41 +09:00
Pratik Naik
57cb8d7924 Use create_and_extract_message_id! to create an inbound email.
This makes sure the created email has checksum and message id columns set.
2019-01-17 14:19:37 -06:00
Pratik Naik
5cd733a334 Ensure Action Mailbox processes an email only once when received multiple times
This also adds a new column, message_checksum, to the action_mailbox_inbound_emails table
for storing SHA1 digest of the email source. Additionally, it makes generating the missing
message id deterministic and adds a unique index on message_checksum and message_id to
detect duplicate emails.
2019-01-17 11:13:40 -06:00
colorbox
620ba4c12a Fix document formatting on ActionMailbox [ci skip]
Use `+` instead of backquote.
2019-01-17 01:10:21 +09:00
George Claghorn
512b5316dd
Add Exim and Qmail support to Action Mailbox 2019-01-12 21:38:26 -05:00
George Claghorn
7aaf9b8076 Tweak Postmark ingress docs [ci skip] 2019-01-09 22:23:51 -05:00
George Claghorn
3c10edcfaf
Merge pull request #34908 from robzolkos/fix-actionmailbox-json
Bring in all of aws-sdk-sns if using Amazon ingress
2019-01-09 19:20:57 -05:00
Tomek Maszkowski
b77d2d9a03 Added Postmark ingress support 2019-01-09 18:00:27 -05:00
Rob Zolkos
fb5c07525f Bring in all of aws-sdk-sns if using Amazon ingress
Requiring _just_ the `Aws::SNS::MessageVerifier` does not work as it
references other classes in the AWS SDK that are not in this one class.

Bringing in the entire SNS SDK verifies the authenticity correctly.
2019-01-09 17:16:08 -05:00
Lachlan Sylvester
0419bc3504 add attachments to the new inbound mail 2019-01-07 10:56:41 +11:00
George Claghorn
d9630c4815 s/Active Mailbox/Action Mailbox/ [ci skip] 2019-01-01 16:43:07 -05:00
George Claghorn
5bb8f3ae67 Fix links in ingress docs [ci skip] 2019-01-01 08:16:38 -05:00
George Claghorn
04d091209a Add load hook for ActionMailbox::InboundEmail 2018-12-31 10:05:13 -05:00
bogdanvlviv
3adb261985
Fix Ruby warnings in actionmailbox
```
rails/actionmailbox$ bundle exec rake tests
(snip)
...
rails/activerecord/lib/active_record/persistence.rb:48: warning: in `create!':
the last argument was passed as a single Hash
rails/actionmailbox/app/models/action_mailbox/inbound_email/message_id.rb:21:
warning: although a splat keyword arguments here
...
(snip)
```
2018-12-27 01:30:29 +02:00
George Claghorn
6c168aaffb Nest Action Mailbox classes in the API docs 2018-12-26 16:18:42 -05:00
George Claghorn
a5b2fff64c Import Action Mailbox 2018-12-25 21:32:35 -05:00