actionmailbox 7.0.4 → 7.1.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +28 -47
  3. data/MIT-LICENSE +1 -1
  4. data/README.md +2 -2
  5. data/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb +1 -0
  6. data/app/controllers/action_mailbox/ingresses/postmark/inbound_emails_controller.rb +1 -0
  7. data/app/controllers/action_mailbox/ingresses/relay/inbound_emails_controller.rb +6 -2
  8. data/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb +1 -0
  9. data/app/controllers/rails/conductor/action_mailbox/inbound_emails/sources_controller.rb +3 -1
  10. data/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb +2 -0
  11. data/app/controllers/rails/conductor/action_mailbox/incinerates_controller.rb +2 -0
  12. data/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb +2 -0
  13. data/app/models/action_mailbox/inbound_email/message_id.rb +1 -1
  14. data/app/models/action_mailbox/inbound_email.rb +8 -0
  15. data/app/views/rails/conductor/action_mailbox/inbound_emails/index.html.erb +3 -3
  16. data/config/routes.rb +1 -1
  17. data/db/migrate/20180917164000_create_action_mailbox_tables.rb +7 -1
  18. data/lib/action_mailbox/base.rb +26 -9
  19. data/lib/action_mailbox/callbacks.rb +2 -0
  20. data/lib/action_mailbox/deprecator.rb +7 -0
  21. data/lib/action_mailbox/engine.rb +4 -0
  22. data/lib/action_mailbox/gem_version.rb +4 -4
  23. data/lib/action_mailbox/mail_ext/addresses.rb +20 -5
  24. data/lib/action_mailbox/mail_ext/recipients.rb +2 -1
  25. data/lib/action_mailbox/router.rb +2 -0
  26. data/lib/action_mailbox/version.rb +1 -1
  27. data/lib/action_mailbox.rb +8 -0
  28. data/lib/rails/generators/mailbox/USAGE +1 -3
  29. data/lib/tasks/install.rake +1 -1
  30. metadata +20 -19
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ae1917d8f72d0ae61e874ba0d0348fc651e646e9c19140736bd13da0990d0778
4
- data.tar.gz: 3269eb37975e14e3477882b89ed7333d17d856eb63a674d38f3270186df8771c
3
+ metadata.gz: f80dcf6d717fdfe10bdcdc1e5ec14b3442609cc43fa965265373e7369dbdb720
4
+ data.tar.gz: 79f41b4f059a815cb5c1870a269cadcdd256f6a6fc56dbb6f19e2e10c5306e62
5
5
  SHA512:
6
- metadata.gz: 30ee535762c293575dce8d6c6246060cd4d604be09c75dd01f1919cbd499ed37d286a0ce3d61ae5312584249e46f69a991bf79d09c1a4d41b21e670edf0a6df1
7
- data.tar.gz: 7669448797270ead7de813591c445f1eb5601d4a75e395e4549694521c65ba7dd85ccb04f4961b50a0cd470c32d59409e052cb23ed3b9975cd4a187e4559c31b
6
+ metadata.gz: 6b90cc6366e57a27f8008a02d011d8d84f668400ab91d8d6a5d6ba63726f43639e72cb1ad3530f7d867ce21f1b80698b1ce9fb4ce8c71c4e53a568675d4b9375
7
+ data.tar.gz: d61480cb04e14e70fc4cba8fcf873444162eb03603af101dd3062ee246adaaf66f6c43f23acf36ccf45e7f00d52cb039351a24cb71c0b420f495a168e54ff06d
data/CHANGELOG.md CHANGED
@@ -1,115 +1,96 @@
1
- ## Rails 7.0.4 (September 09, 2022) ##
1
+ ## Rails 7.1.5.1 (December 10, 2024) ##
2
2
 
3
3
  * No changes.
4
4
 
5
5
 
6
- ## Rails 7.0.3.1 (July 12, 2022) ##
6
+ ## Rails 7.1.5 (October 30, 2024) ##
7
7
 
8
8
  * No changes.
9
9
 
10
10
 
11
- ## Rails 7.0.3 (May 09, 2022) ##
11
+ ## Rails 7.1.4.2 (October 23, 2024) ##
12
12
 
13
13
  * No changes.
14
14
 
15
15
 
16
- ## Rails 7.0.2.4 (April 26, 2022) ##
16
+ ## Rails 7.1.4.1 (October 15, 2024) ##
17
17
 
18
18
  * No changes.
19
19
 
20
20
 
21
- ## Rails 7.0.2.3 (March 08, 2022) ##
21
+ ## Rails 7.1.4 (August 22, 2024) ##
22
22
 
23
23
  * No changes.
24
24
 
25
25
 
26
- ## Rails 7.0.2.2 (February 11, 2022) ##
26
+ ## Rails 7.1.3.4 (June 04, 2024) ##
27
27
 
28
28
  * No changes.
29
29
 
30
30
 
31
- ## Rails 7.0.2.1 (February 11, 2022) ##
31
+ ## Rails 7.1.3.3 (May 16, 2024) ##
32
32
 
33
33
  * No changes.
34
34
 
35
35
 
36
- ## Rails 7.0.2 (February 08, 2022) ##
36
+ ## Rails 7.1.3.2 (February 21, 2024) ##
37
37
 
38
38
  * No changes.
39
39
 
40
40
 
41
- ## Rails 7.0.1 (January 06, 2022) ##
41
+ ## Rails 7.1.3.1 (February 21, 2024) ##
42
42
 
43
43
  * No changes.
44
44
 
45
45
 
46
- ## Rails 7.0.0 (December 15, 2021) ##
46
+ ## Rails 7.1.3 (January 16, 2024) ##
47
47
 
48
48
  * No changes.
49
49
 
50
50
 
51
- ## Rails 7.0.0.rc3 (December 14, 2021) ##
51
+ ## Rails 7.1.2 (November 10, 2023) ##
52
52
 
53
53
  * No changes.
54
54
 
55
55
 
56
- ## Rails 7.0.0.rc2 (December 14, 2021) ##
56
+ ## Rails 7.1.1 (October 11, 2023) ##
57
57
 
58
58
  * No changes.
59
59
 
60
- ## Rails 7.0.0.rc1 (December 06, 2021) ##
61
60
 
62
- * Removed deprecated environment variable `MAILGUN_INGRESS_API_KEY`.
61
+ ## Rails 7.1.0 (October 05, 2023) ##
63
62
 
64
- *Rafael Mendonça França*
65
-
66
- * Removed deprecated `Rails.application.credentials.action_mailbox.mailgun_api_key`.
67
-
68
- *Rafael Mendonça França*
63
+ * No changes.
69
64
 
70
65
 
71
- ## Rails 7.0.0.alpha2 (September 15, 2021) ##
66
+ ## Rails 7.1.0.rc2 (October 01, 2023) ##
72
67
 
73
68
  * No changes.
74
69
 
75
70
 
76
- ## Rails 7.0.0.alpha1 (September 15, 2021) ##
71
+ ## Rails 7.1.0.rc1 (September 27, 2023) ##
77
72
 
78
- * Add `attachments` to the list of permitted parameters for inbound emails conductor.
79
-
80
- When using the conductor to test inbound emails with attachments, this prevents an
81
- unpermitted parameter warning in default configurations, and prevents errors for
82
- applications that set:
73
+ * No changes.
83
74
 
84
- ```ruby
85
- config.action_controller.action_on_unpermitted_parameters = :raise
86
- ```
87
75
 
88
- *David Jones*, *Dana Henke*
76
+ ## Rails 7.1.0.beta1 (September 13, 2023) ##
89
77
 
90
- * Add ability to configure ActiveStorage service
91
- for storing email raw source.
78
+ * Added `bounce_now_with` to send the bounce email without going through a mailer queue.
92
79
 
93
- ```yml
94
- # config/storage.yml
95
- incoming_emails:
96
- service: Disk
97
- root: /secure/dir/for/emails/only
98
- ```
80
+ *Ronan Limon Duparcmeur*
99
81
 
100
- ```ruby
101
- config.action_mailbox.storage_service = :incoming_emails
102
- ```
82
+ * Support configured primary key types in generated migrations.
103
83
 
104
- *Yurii Rashkovskii*
84
+ *Nishiki Liu*
105
85
 
106
- * Add ability to incinerate an inbound message through the conductor interface.
86
+ * Fixed ingress controllers' ability to accept emails that contain no UTF-8 encoded parts.
107
87
 
108
- *Santiago Bartesaghi*
88
+ Fixes #46297.
109
89
 
110
- * OpenSSL constants are now used for Digest computations.
90
+ *Jan Honza Sterba*
111
91
 
112
- *Dirkjan Bussink*
92
+ * Add X-Forwarded-To addresses to recipients.
113
93
 
94
+ *Andrew Stewart*
114
95
 
115
- Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailbox/CHANGELOG.md) for previous changes.
96
+ Please check [7-0-stable](https://github.com/rails/rails/blob/7-0-stable/actionmailbox/CHANGELOG.md) for previous changes.
data/MIT-LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2018-2022 Basecamp, LLC
3
+ Copyright (c) 37signals LLC
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Action Mailbox
2
2
 
3
- Action Mailbox routes incoming emails to controller-like mailboxes for processing in Rails. It ships with ingresses for Mailgun, Mandrill, Postmark, and SendGrid. You can also handle inbound mails directly via the built-in Exim, Postfix, and Qmail ingresses.
3
+ Action Mailbox routes incoming emails to controller-like mailboxes for processing in \Rails. It ships with ingresses for Mailgun, Mandrill, Postmark, and SendGrid. You can also handle inbound mails directly via the built-in Exim, Postfix, and Qmail ingresses.
4
4
 
5
5
  The inbound emails are turned into `InboundEmail` records using Active Record and feature lifecycle tracking, storage of the original email on cloud storage via Active Storage, and responsible data handling with on-by-default incineration.
6
6
 
7
7
  These inbound emails are routed asynchronously using Active Job to one or several dedicated mailboxes, which are capable of interacting directly with the rest of your domain model.
8
8
 
9
- You can read more about Action Mailbox in the [Action Mailbox Basics](https://edgeguides.rubyonrails.org/action_mailbox_basics.html) guide.
9
+ You can read more about Action Mailbox in the [Action Mailbox Basics](https://guides.rubyonrails.org/action_mailbox_basics.html) guide.
10
10
 
11
11
  ## License
12
12
 
@@ -44,6 +44,7 @@ module ActionMailbox
44
44
  # <tt>https://example.com/rails/action_mailbox/mailgun/inbound_emails/mime</tt>.
45
45
  class Ingresses::Mailgun::InboundEmailsController < ActionMailbox::BaseController
46
46
  before_action :authenticate
47
+ param_encoding :create, "body-mime", Encoding::ASCII_8BIT
47
48
 
48
49
  def create
49
50
  ActionMailbox::InboundEmail.create_and_extract_message_id! mail
@@ -46,6 +46,7 @@ module ActionMailbox
46
46
  # content in JSON payload"*. Action Mailbox needs the raw email content to work.
47
47
  class Ingresses::Postmark::InboundEmailsController < ActionMailbox::BaseController
48
48
  before_action :authenticate_by_password
49
+ param_encoding :create, "RawEmail", Encoding::ASCII_8BIT
49
50
 
50
51
  def create
51
52
  ActionMailbox::InboundEmail.create_and_extract_message_id! params.require("RawEmail")
@@ -41,7 +41,7 @@ module ActionMailbox
41
41
  # If your application lives at <tt>https://example.com</tt>, you would configure the Postfix SMTP server to pipe
42
42
  # inbound emails to the following command:
43
43
  #
44
- # bin/rails action_mailbox:ingress:postfix URL=https://example.com/rails/action_mailbox/postfix/inbound_emails INGRESS_PASSWORD=...
44
+ # $ bin/rails action_mailbox:ingress:postfix URL=https://example.com/rails/action_mailbox/postfix/inbound_emails INGRESS_PASSWORD=...
45
45
  #
46
46
  # Built-in ingress commands are available for these popular SMTP servers:
47
47
  #
@@ -52,7 +52,11 @@ module ActionMailbox
52
52
  before_action :authenticate_by_password, :require_valid_rfc822_message
53
53
 
54
54
  def create
55
- ActionMailbox::InboundEmail.create_and_extract_message_id! request.body.read
55
+ if request.body
56
+ ActionMailbox::InboundEmail.create_and_extract_message_id! request.body.read
57
+ else
58
+ head :unprocessable_entity
59
+ end
56
60
  end
57
61
 
58
62
  private
@@ -46,6 +46,7 @@ module ActionMailbox
46
46
  # full MIME message."* Action Mailbox needs the raw MIME message to work.
47
47
  class Ingresses::Sendgrid::InboundEmailsController < ActionMailbox::BaseController
48
48
  before_action :authenticate_by_password
49
+ param_encoding :create, :email, Encoding::ASCII_8BIT
49
50
 
50
51
  def create
51
52
  ActionMailbox::InboundEmail.create_and_extract_message_id! mail
@@ -1,7 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :enddoc:
4
+
3
5
  module Rails
4
- class Conductor::ActionMailbox::InboundEmails::SourcesController < Rails::Conductor::BaseController
6
+ class Conductor::ActionMailbox::InboundEmails::SourcesController < Rails::Conductor::BaseController # :nodoc:
5
7
  def new
6
8
  end
7
9
 
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :enddoc:
4
+
3
5
  module Rails
4
6
  class Conductor::ActionMailbox::InboundEmailsController < Rails::Conductor::BaseController
5
7
  def index
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :enddoc:
4
+
3
5
  module Rails
4
6
  # Incinerating will destroy an email that is due and has already been processed.
5
7
  class Conductor::ActionMailbox::IncineratesController < Rails::Conductor::BaseController
@@ -1,5 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ # :enddoc:
4
+
3
5
  module Rails
4
6
  # Rerouting will run routing and processing on an email that has already been, or attempted to be, processed.
5
7
  class Conductor::ActionMailbox::ReroutesController < Rails::Conductor::BaseController
@@ -5,7 +5,7 @@
5
5
  # web request.
6
6
  #
7
7
  # If an inbound email does not, against the rfc822 mandate, specify a Message-ID, one will be generated
8
- # using the approach from <tt>Mail::MessageIdField</tt>.
8
+ # using the approach from +Mail::MessageIdField+.
9
9
  module ActionMailbox::InboundEmail::MessageId
10
10
  extend ActiveSupport::Concern
11
11
 
@@ -43,6 +43,14 @@ module ActionMailbox
43
43
  def processed?
44
44
  delivered? || failed? || bounced?
45
45
  end
46
+
47
+ def instrumentation_payload # :nodoc:
48
+ {
49
+ id: id,
50
+ message_id: message_id,
51
+ status: status
52
+ }
53
+ end
46
54
  end
47
55
  end
48
56
 
@@ -2,6 +2,9 @@
2
2
 
3
3
  <h1>All inbound emails</h1>
4
4
 
5
+ <%= link_to "New inbound email by form", main_app.new_rails_conductor_inbound_email_path %> |
6
+ <%= link_to "New inbound email by source", main_app.new_rails_conductor_inbound_email_source_path %>
7
+
5
8
  <table>
6
9
  <tr><th>Message ID</th><th>Status</th></tr>
7
10
  <% @inbound_emails.each do |inbound_email| %>
@@ -11,6 +14,3 @@
11
14
  </tr>
12
15
  <% end %>
13
16
  </table>
14
-
15
- <%= link_to "New inbound email by form", main_app.new_rails_conductor_inbound_email_path %> |
16
- <%= link_to "New inbound email by source", main_app.new_rails_conductor_inbound_email_source_path %>
data/config/routes.rb CHANGED
@@ -16,7 +16,7 @@ Rails.application.routes.draw do
16
16
 
17
17
  # TODO: Should these be mounted within the engine only?
18
18
  scope "rails/conductor/action_mailbox/", module: "rails/conductor/action_mailbox" do
19
- resources :inbound_emails, as: :rails_conductor_inbound_emails
19
+ resources :inbound_emails, as: :rails_conductor_inbound_emails, only: %i[index new show create]
20
20
  get "inbound_emails/sources/new", to: "inbound_emails/sources#new", as: :new_rails_conductor_inbound_email_source
21
21
  post "inbound_emails/sources", to: "inbound_emails/sources#create", as: :rails_conductor_inbound_email_sources
22
22
 
@@ -1,6 +1,6 @@
1
1
  class CreateActionMailboxTables < ActiveRecord::Migration[6.0]
2
2
  def change
3
- create_table :action_mailbox_inbound_emails do |t|
3
+ create_table :action_mailbox_inbound_emails, id: primary_key_type do |t|
4
4
  t.integer :status, default: 0, null: false
5
5
  t.string :message_id, null: false
6
6
  t.string :message_checksum, null: false
@@ -10,4 +10,10 @@ class CreateActionMailboxTables < ActiveRecord::Migration[6.0]
10
10
  t.index [ :message_id, :message_checksum ], name: "index_action_mailbox_inbound_emails_uniqueness", unique: true
11
11
  end
12
12
  end
13
+
14
+ private
15
+ def primary_key_type
16
+ config = Rails.configuration.generators
17
+ config.options[config.orm][:primary_key_type] || :primary_key
18
+ end
13
19
  end
@@ -6,6 +6,8 @@ require "action_mailbox/callbacks"
6
6
  require "action_mailbox/routing"
7
7
 
8
8
  module ActionMailbox
9
+ # = Action Mailbox \Base
10
+ #
9
11
  # The base class for all application mailboxes. Not intended to be inherited from directly. Inherit from
10
12
  # +ApplicationMailbox+ instead, as that's where the app-specific routing is configured. This routing
11
13
  # is specified in the following ways:
@@ -29,7 +31,7 @@ module ActionMailbox
29
31
  #
30
32
  # Application mailboxes need to override the #process method, which is invoked by the framework after
31
33
  # callbacks have been run. The callbacks available are: +before_processing+, +after_processing+, and
32
- # +around_processing+. The primary use case is ensure certain preconditions to processing are fulfilled
34
+ # +around_processing+. The primary use case is to ensure that certain preconditions to processing are fulfilled
33
35
  # using +before_processing+ callbacks.
34
36
  #
35
37
  # If a precondition fails to be met, you can halt the processing using the +#bounced!+ method,
@@ -55,7 +57,8 @@ module ActionMailbox
55
57
  # complete, the status is changed to +delivered+. If a bounce is triggered, then +bounced+. If an unhandled
56
58
  # exception is bubbled up, then +failed+.
57
59
  #
58
- # Exceptions can be handled at the class level using the familiar +Rescuable+ approach:
60
+ # Exceptions can be handled at the class level using the familiar
61
+ # ActiveSupport::Rescuable approach:
59
62
  #
60
63
  # class ForwardsMailbox < ApplicationMailbox
61
64
  # rescue_from(ApplicationSpecificVerificationError) { bounced! }
@@ -78,14 +81,16 @@ module ActionMailbox
78
81
  end
79
82
 
80
83
  def perform_processing # :nodoc:
81
- track_status_of_inbound_email do
82
- run_callbacks :process do
83
- process
84
+ ActiveSupport::Notifications.instrument "process.action_mailbox", instrumentation_payload do
85
+ track_status_of_inbound_email do
86
+ run_callbacks :process do
87
+ process
88
+ end
84
89
  end
90
+ rescue => exception
91
+ # TODO: Include a reference to the inbound_email in the exception raised so error handling becomes easier
92
+ rescue_with_handler(exception) || raise
85
93
  end
86
- rescue => exception
87
- # TODO: Include a reference to the inbound_email in the exception raised so error handling becomes easier
88
- rescue_with_handler(exception) || raise
89
94
  end
90
95
 
91
96
  def process
@@ -96,14 +101,26 @@ module ActionMailbox
96
101
  inbound_email.delivered? || inbound_email.bounced?
97
102
  end
98
103
 
99
-
100
104
  # Enqueues the given +message+ for delivery and changes the inbound email's status to +:bounced+.
101
105
  def bounce_with(message)
102
106
  inbound_email.bounced!
103
107
  message.deliver_later
104
108
  end
105
109
 
110
+ # Immediately sends the given +message+ and changes the inbound email's status to +:bounced+.
111
+ def bounce_now_with(message)
112
+ inbound_email.bounced!
113
+ message.deliver_now
114
+ end
115
+
106
116
  private
117
+ def instrumentation_payload
118
+ {
119
+ mailbox: self,
120
+ inbound_email: inbound_email.instrumentation_payload
121
+ }
122
+ end
123
+
107
124
  def track_status_of_inbound_email
108
125
  inbound_email.processing!
109
126
  yield
@@ -3,6 +3,8 @@
3
3
  require "active_support/callbacks"
4
4
 
5
5
  module ActionMailbox
6
+ # = Action Mailbox \Callbacks
7
+ #
6
8
  # Defines the callbacks related to processing.
7
9
  module Callbacks
8
10
  extend ActiveSupport::Concern
@@ -0,0 +1,7 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ActionMailbox
4
+ def self.deprecator # :nodoc:
5
+ @deprecator ||= ActiveSupport::Deprecation.new
6
+ end
7
+ end
@@ -22,6 +22,10 @@ module ActionMailbox
22
22
 
23
23
  config.action_mailbox.storage_service = nil
24
24
 
25
+ initializer "action_mailbox.deprecator", before: :load_environment_config do |app|
26
+ app.deprecators[:action_mailbox] = ActionMailbox.deprecator
27
+ end
28
+
25
29
  initializer "action_mailbox.config" do
26
30
  config.after_initialize do |app|
27
31
  ActionMailbox.logger = app.config.action_mailbox.logger || Rails.logger
@@ -1,16 +1,16 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionMailbox
4
- # Returns the currently loaded version of Action Mailbox as a <tt>Gem::Version</tt>.
4
+ # Returns the currently loaded version of Action Mailbox as a +Gem::Version+.
5
5
  def self.gem_version
6
6
  Gem::Version.new VERSION::STRING
7
7
  end
8
8
 
9
9
  module VERSION
10
10
  MAJOR = 7
11
- MINOR = 0
12
- TINY = 4
13
- PRE = nil
11
+ MINOR = 1
12
+ TINY = 5
13
+ PRE = "1"
14
14
 
15
15
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
16
16
  end
@@ -3,27 +3,42 @@
3
3
  module Mail
4
4
  class Message
5
5
  def from_address
6
- header[:from]&.address_list&.addresses&.first
6
+ address_list(header[:from])&.addresses&.first
7
7
  end
8
8
 
9
9
  def recipients_addresses
10
- to_addresses + cc_addresses + bcc_addresses + x_original_to_addresses
10
+ to_addresses + cc_addresses + bcc_addresses + x_original_to_addresses + x_forwarded_to_addresses
11
11
  end
12
12
 
13
13
  def to_addresses
14
- Array(header[:to]&.address_list&.addresses)
14
+ Array(address_list(header[:to])&.addresses)
15
15
  end
16
16
 
17
17
  def cc_addresses
18
- Array(header[:cc]&.address_list&.addresses)
18
+ Array(address_list(header[:cc])&.addresses)
19
19
  end
20
20
 
21
21
  def bcc_addresses
22
- Array(header[:bcc]&.address_list&.addresses)
22
+ Array(address_list(header[:bcc])&.addresses)
23
23
  end
24
24
 
25
25
  def x_original_to_addresses
26
26
  Array(header[:x_original_to]).collect { |header| Mail::Address.new header.to_s }
27
27
  end
28
+
29
+ def x_forwarded_to_addresses
30
+ Array(header[:x_forwarded_to]).collect { |header| Mail::Address.new header.to_s }
31
+ end
32
+
33
+ private
34
+ def address_list(obj)
35
+ if obj&.respond_to?(:element)
36
+ # Mail 2.8+
37
+ obj.element
38
+ else
39
+ # Mail <= 2.7.x
40
+ obj&.address_list
41
+ end
42
+ end
28
43
  end
29
44
  end
@@ -3,7 +3,8 @@
3
3
  module Mail
4
4
  class Message
5
5
  def recipients
6
- Array(to) + Array(cc) + Array(bcc) + Array(header[:x_original_to]).map(&:to_s)
6
+ Array(to) + Array(cc) + Array(bcc) + Array(header[:x_original_to]).map(&:to_s) +
7
+ Array(header[:x_forwarded_to]).map(&:to_s)
7
8
  end
8
9
  end
9
10
  end
@@ -1,6 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module ActionMailbox
4
+ # = Action Mailbox \Router
5
+ #
4
6
  # Encapsulates the routes that live on the ApplicationMailbox and performs the actual routing when
5
7
  # an inbound_email is received.
6
8
  class Router
@@ -3,7 +3,7 @@
3
3
  require_relative "gem_version"
4
4
 
5
5
  module ActionMailbox
6
- # Returns the currently loaded version of Action Mailbox as a <tt>Gem::Version</tt>.
6
+ # Returns the currently loaded version of Action Mailbox as a +Gem::Version+.
7
7
  def self.version
8
8
  gem_version
9
9
  end
@@ -1,7 +1,15 @@
1
1
  # frozen_string_literal: true
2
2
 
3
+ require "active_support"
4
+ require "active_support/rails"
5
+ require "active_support/core_ext/numeric/time"
6
+
7
+ require "action_mailbox/version"
8
+ require "action_mailbox/deprecator"
3
9
  require "action_mailbox/mail_ext"
4
10
 
11
+ # :markup: markdown
12
+ # :include: ../README.md
5
13
  module ActionMailbox
6
14
  extend ActiveSupport::Autoload
7
15
 
@@ -1,11 +1,9 @@
1
1
  Description:
2
- ============
3
2
  Generates a new mailbox class in app/mailboxes and invokes your template
4
3
  engine and test framework generators.
5
4
 
6
5
  Example:
7
- ========
8
- bin/rails generate mailbox inbox
6
+ `bin/rails generate mailbox inbox`
9
7
 
10
8
  creates an InboxMailbox class and test:
11
9
  Mailbox: app/mailboxes/inbox_mailbox.rb
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- desc "Installs Action Mailbox and its dependencies"
3
+ desc "Install Action Mailbox and its dependencies"
4
4
  task "action_mailbox:install" do
5
5
  Rails::Command.invoke :generate, ["action_mailbox:install"]
6
6
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: actionmailbox
3
3
  version: !ruby/object:Gem::Version
4
- version: 7.0.4
4
+ version: 7.1.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Heinemeier Hansson
8
8
  - George Claghorn
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2022-09-09 00:00:00.000000000 Z
12
+ date: 2024-12-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
@@ -17,70 +17,70 @@ dependencies:
17
17
  requirements:
18
18
  - - '='
19
19
  - !ruby/object:Gem::Version
20
- version: 7.0.4
20
+ version: 7.1.5.1
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - '='
26
26
  - !ruby/object:Gem::Version
27
- version: 7.0.4
27
+ version: 7.1.5.1
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: activerecord
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
32
  - - '='
33
33
  - !ruby/object:Gem::Version
34
- version: 7.0.4
34
+ version: 7.1.5.1
35
35
  type: :runtime
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 7.0.4
41
+ version: 7.1.5.1
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: activestorage
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 7.0.4
48
+ version: 7.1.5.1
49
49
  type: :runtime
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
53
  - - '='
54
54
  - !ruby/object:Gem::Version
55
- version: 7.0.4
55
+ version: 7.1.5.1
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: activejob
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
60
  - - '='
61
61
  - !ruby/object:Gem::Version
62
- version: 7.0.4
62
+ version: 7.1.5.1
63
63
  type: :runtime
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
67
  - - '='
68
68
  - !ruby/object:Gem::Version
69
- version: 7.0.4
69
+ version: 7.1.5.1
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: actionpack
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
74
  - - '='
75
75
  - !ruby/object:Gem::Version
76
- version: 7.0.4
76
+ version: 7.1.5.1
77
77
  type: :runtime
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
81
  - - '='
82
82
  - !ruby/object:Gem::Version
83
- version: 7.0.4
83
+ version: 7.1.5.1
84
84
  - !ruby/object:Gem::Dependency
85
85
  name: mail
86
86
  requirement: !ruby/object:Gem::Requirement
@@ -177,6 +177,7 @@ files:
177
177
  - lib/action_mailbox.rb
178
178
  - lib/action_mailbox/base.rb
179
179
  - lib/action_mailbox/callbacks.rb
180
+ - lib/action_mailbox/deprecator.rb
180
181
  - lib/action_mailbox/engine.rb
181
182
  - lib/action_mailbox/gem_version.rb
182
183
  - lib/action_mailbox/mail_ext.rb
@@ -206,12 +207,12 @@ licenses:
206
207
  - MIT
207
208
  metadata:
208
209
  bug_tracker_uri: https://github.com/rails/rails/issues
209
- changelog_uri: https://github.com/rails/rails/blob/v7.0.4/actionmailbox/CHANGELOG.md
210
- documentation_uri: https://api.rubyonrails.org/v7.0.4/
210
+ changelog_uri: https://github.com/rails/rails/blob/v7.1.5.1/actionmailbox/CHANGELOG.md
211
+ documentation_uri: https://api.rubyonrails.org/v7.1.5.1/
211
212
  mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
212
- source_code_uri: https://github.com/rails/rails/tree/v7.0.4/actionmailbox
213
+ source_code_uri: https://github.com/rails/rails/tree/v7.1.5.1/actionmailbox
213
214
  rubygems_mfa_required: 'true'
214
- post_install_message:
215
+ post_install_message:
215
216
  rdoc_options: []
216
217
  require_paths:
217
218
  - lib
@@ -226,8 +227,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
226
227
  - !ruby/object:Gem::Version
227
228
  version: '0'
228
229
  requirements: []
229
- rubygems_version: 3.3.3
230
- signing_key:
230
+ rubygems_version: 3.5.22
231
+ signing_key:
231
232
  specification_version: 4
232
233
  summary: Inbound email handling framework.
233
234
  test_files: []