actionmailbox 6.1.7.8 → 7.0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +60 -61
- data/app/controllers/action_mailbox/base_controller.rb +1 -1
- data/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb +1 -15
- data/app/controllers/action_mailbox/ingresses/relay/inbound_emails_controller.rb +1 -1
- data/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb +1 -1
- data/app/controllers/rails/conductor/action_mailbox/incinerates_controller.rb +12 -0
- data/app/models/action_mailbox/inbound_email/message_id.rb +8 -4
- data/app/models/action_mailbox/inbound_email.rb +2 -2
- data/app/models/action_mailbox/record.rb +1 -1
- data/app/views/rails/conductor/action_mailbox/inbound_emails/show.html.erb +1 -1
- data/config/routes.rb +1 -0
- data/lib/action_mailbox/base.rb +8 -7
- data/lib/action_mailbox/engine.rb +3 -0
- data/lib/action_mailbox/gem_version.rb +5 -5
- data/lib/action_mailbox/mail_ext/addresses.rb +15 -4
- data/lib/action_mailbox/mail_ext.rb +1 -1
- data/lib/action_mailbox/router/route.rb +1 -1
- data/lib/action_mailbox/routing.rb +1 -1
- data/lib/action_mailbox/test_helper.rb +9 -10
- data/lib/action_mailbox/version.rb +1 -1
- data/lib/action_mailbox.rb +1 -0
- metadata +58 -16
- data/lib/action_mailbox/mail_with_error_handling.rb +0 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 23efdbd3b90be259dd58527560d3caaaaffb6fb1b63f8c92807f1991b7b6e8a4
|
4
|
+
data.tar.gz: a176f2143a3317bdc719453ab1f7d7284103a2101663b66543164dbd2c1a5ec9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f62a0f450f41b47001d60bd71d29e0779e2b02343e252ba8d762102d37d1bceef8918506d6207951232397cf159652a82a4ff4ac507ccadf6a052568839f71e
|
7
|
+
data.tar.gz: d4adf49ece702130dfc0ac23b5ffd3f753944bbe6f6859c065eee4cc7788d99b572d6fea3d4d796b043768da3d267f79adc6642b3e29ed45f335b368ada65c5c
|
data/CHANGELOG.md
CHANGED
@@ -1,186 +1,185 @@
|
|
1
|
-
## Rails
|
1
|
+
## Rails 7.0.8.4 (June 04, 2024) ##
|
2
2
|
|
3
3
|
* No changes.
|
4
4
|
|
5
5
|
|
6
|
-
## Rails
|
6
|
+
## Rails 7.0.8.3 (May 17, 2024) ##
|
7
7
|
|
8
8
|
* No changes.
|
9
9
|
|
10
10
|
|
11
|
-
## Rails
|
11
|
+
## Rails 7.0.8.2 (May 16, 2024) ##
|
12
12
|
|
13
13
|
* No changes.
|
14
14
|
|
15
15
|
|
16
|
-
## Rails
|
16
|
+
## Rails 7.0.8.1 (February 21, 2024) ##
|
17
17
|
|
18
18
|
* No changes.
|
19
19
|
|
20
20
|
|
21
|
-
## Rails
|
21
|
+
## Rails 7.0.8 (September 09, 2023) ##
|
22
22
|
|
23
23
|
* No changes.
|
24
24
|
|
25
25
|
|
26
|
-
## Rails
|
26
|
+
## Rails 7.0.7.2 (August 22, 2023) ##
|
27
27
|
|
28
28
|
* No changes.
|
29
29
|
|
30
30
|
|
31
|
-
## Rails
|
31
|
+
## Rails 7.0.7.1 (August 22, 2023) ##
|
32
32
|
|
33
33
|
* No changes.
|
34
34
|
|
35
35
|
|
36
|
-
## Rails
|
36
|
+
## Rails 7.0.7 (August 09, 2023) ##
|
37
37
|
|
38
38
|
* No changes.
|
39
39
|
|
40
40
|
|
41
|
-
## Rails
|
41
|
+
## Rails 7.0.6 (June 29, 2023) ##
|
42
42
|
|
43
43
|
* No changes.
|
44
44
|
|
45
45
|
|
46
|
-
## Rails
|
46
|
+
## Rails 7.0.5.1 (June 26, 2023) ##
|
47
47
|
|
48
48
|
* No changes.
|
49
49
|
|
50
50
|
|
51
|
-
## Rails
|
51
|
+
## Rails 7.0.5 (May 24, 2023) ##
|
52
52
|
|
53
53
|
* No changes.
|
54
54
|
|
55
55
|
|
56
|
-
## Rails
|
56
|
+
## Rails 7.0.4.3 (March 13, 2023) ##
|
57
57
|
|
58
58
|
* No changes.
|
59
59
|
|
60
60
|
|
61
|
-
## Rails
|
62
|
-
|
63
|
-
* Add `attachments` to the list of permitted parameters for inbound emails conductor.
|
64
|
-
|
65
|
-
When using the conductor to test inbound emails with attachments, this prevents an
|
66
|
-
unpermitted parameter warning in default configurations, and prevents errors for
|
67
|
-
applications that set:
|
68
|
-
|
69
|
-
```ruby
|
70
|
-
config.action_controller.action_on_unpermitted_parameters = :raise
|
71
|
-
```
|
72
|
-
|
73
|
-
*David Jones*, *Dana Henke*
|
74
|
-
|
75
|
-
|
76
|
-
## Rails 6.1.4.7 (March 08, 2022) ##
|
61
|
+
## Rails 7.0.4.2 (January 24, 2023) ##
|
77
62
|
|
78
63
|
* No changes.
|
79
64
|
|
80
65
|
|
81
|
-
## Rails
|
66
|
+
## Rails 7.0.4.1 (January 17, 2023) ##
|
82
67
|
|
83
68
|
* No changes.
|
84
69
|
|
85
70
|
|
86
|
-
## Rails
|
71
|
+
## Rails 7.0.4 (September 09, 2022) ##
|
87
72
|
|
88
73
|
* No changes.
|
89
74
|
|
90
75
|
|
91
|
-
## Rails
|
76
|
+
## Rails 7.0.3.1 (July 12, 2022) ##
|
92
77
|
|
93
78
|
* No changes.
|
94
79
|
|
95
80
|
|
96
|
-
## Rails
|
81
|
+
## Rails 7.0.3 (May 09, 2022) ##
|
97
82
|
|
98
83
|
* No changes.
|
99
84
|
|
100
85
|
|
101
|
-
## Rails
|
86
|
+
## Rails 7.0.2.4 (April 26, 2022) ##
|
102
87
|
|
103
88
|
* No changes.
|
104
89
|
|
105
90
|
|
106
|
-
## Rails
|
91
|
+
## Rails 7.0.2.3 (March 08, 2022) ##
|
107
92
|
|
108
93
|
* No changes.
|
109
94
|
|
110
95
|
|
111
|
-
## Rails
|
96
|
+
## Rails 7.0.2.2 (February 11, 2022) ##
|
112
97
|
|
113
98
|
* No changes.
|
114
99
|
|
115
100
|
|
116
|
-
## Rails
|
101
|
+
## Rails 7.0.2.1 (February 11, 2022) ##
|
117
102
|
|
118
103
|
* No changes.
|
119
104
|
|
120
105
|
|
121
|
-
## Rails
|
106
|
+
## Rails 7.0.2 (February 08, 2022) ##
|
122
107
|
|
123
108
|
* No changes.
|
124
109
|
|
125
110
|
|
126
|
-
## Rails
|
111
|
+
## Rails 7.0.1 (January 06, 2022) ##
|
127
112
|
|
128
113
|
* No changes.
|
129
114
|
|
130
115
|
|
131
|
-
## Rails
|
116
|
+
## Rails 7.0.0 (December 15, 2021) ##
|
132
117
|
|
133
118
|
* No changes.
|
134
119
|
|
135
120
|
|
136
|
-
## Rails
|
121
|
+
## Rails 7.0.0.rc3 (December 14, 2021) ##
|
137
122
|
|
138
123
|
* No changes.
|
139
124
|
|
140
125
|
|
141
|
-
## Rails
|
126
|
+
## Rails 7.0.0.rc2 (December 14, 2021) ##
|
142
127
|
|
143
128
|
* No changes.
|
144
129
|
|
130
|
+
## Rails 7.0.0.rc1 (December 06, 2021) ##
|
145
131
|
|
146
|
-
|
132
|
+
* Removed deprecated environment variable `MAILGUN_INGRESS_API_KEY`.
|
147
133
|
|
148
|
-
*
|
149
|
-
|
134
|
+
*Rafael Mendonça França*
|
135
|
+
|
136
|
+
* Removed deprecated `Rails.application.credentials.action_mailbox.mailgun_api_key`.
|
150
137
|
|
151
138
|
*Rafael Mendonça França*
|
152
139
|
|
153
|
-
* Sendgrid ingress now passes through the envelope recipient as `X-Original-To`.
|
154
140
|
|
155
|
-
|
141
|
+
## Rails 7.0.0.alpha2 (September 15, 2021) ##
|
142
|
+
|
143
|
+
* No changes.
|
156
144
|
|
157
|
-
* Update Mandrill inbound email route to respond appropriately to HEAD requests for URL health checks from Mandrill.
|
158
145
|
|
159
|
-
|
146
|
+
## Rails 7.0.0.alpha1 (September 15, 2021) ##
|
160
147
|
|
161
|
-
* Add
|
148
|
+
* Add `attachments` to the list of permitted parameters for inbound emails conductor.
|
162
149
|
|
163
|
-
|
150
|
+
When using the conductor to test inbound emails with attachments, this prevents an
|
151
|
+
unpermitted parameter warning in default configurations, and prevents errors for
|
152
|
+
applications that set:
|
164
153
|
|
165
|
-
|
154
|
+
```ruby
|
155
|
+
config.action_controller.action_on_unpermitted_parameters = :raise
|
156
|
+
```
|
166
157
|
|
167
|
-
*
|
158
|
+
*David Jones*, *Dana Henke*
|
168
159
|
|
169
|
-
*
|
160
|
+
* Add ability to configure ActiveStorage service
|
161
|
+
for storing email raw source.
|
170
162
|
|
171
|
-
|
163
|
+
```yml
|
164
|
+
# config/storage.yml
|
165
|
+
incoming_emails:
|
166
|
+
service: Disk
|
167
|
+
root: /secure/dir/for/emails/only
|
168
|
+
```
|
172
169
|
|
173
|
-
|
170
|
+
```ruby
|
171
|
+
config.action_mailbox.storage_service = :incoming_emails
|
172
|
+
```
|
174
173
|
|
175
|
-
*
|
174
|
+
*Yurii Rashkovskii*
|
176
175
|
|
177
|
-
*
|
176
|
+
* Add ability to incinerate an inbound message through the conductor interface.
|
178
177
|
|
179
|
-
*
|
178
|
+
*Santiago Bartesaghi*
|
180
179
|
|
181
|
-
*
|
180
|
+
* OpenSSL constants are now used for Digest computations.
|
182
181
|
|
183
|
-
*
|
182
|
+
*Dirkjan Bussink*
|
184
183
|
|
185
184
|
|
186
|
-
Please check [6-
|
185
|
+
Please check [6-1-stable](https://github.com/rails/rails/blob/6-1-stable/actionmailbox/CHANGELOG.md) for previous changes.
|
@@ -77,21 +77,7 @@ module ActionMailbox
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def key
|
80
|
-
|
81
|
-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
82
|
-
Rails.application.credentials.action_mailbox.api_key is deprecated and will be ignored in Rails 7.0.
|
83
|
-
Use Rails.application.credentials.action_mailbox.signing_key instead.
|
84
|
-
MSG
|
85
|
-
Rails.application.credentials.dig(:action_mailbox, :mailgun_api_key)
|
86
|
-
elsif ENV["MAILGUN_INGRESS_API_KEY"]
|
87
|
-
ActiveSupport::Deprecation.warn(<<-MSG.squish)
|
88
|
-
The MAILGUN_INGRESS_API_KEY environment variable is deprecated and will be ignored in Rails 7.0.
|
89
|
-
Use MAILGUN_INGRESS_SIGNING_KEY instead.
|
90
|
-
MSG
|
91
|
-
ENV["MAILGUN_INGRESS_API_KEY"]
|
92
|
-
else
|
93
|
-
Rails.application.credentials.dig(:action_mailbox, :mailgun_signing_key) || ENV["MAILGUN_INGRESS_SIGNING_KEY"]
|
94
|
-
end
|
80
|
+
Rails.application.credentials.dig(:action_mailbox, :mailgun_signing_key) || ENV["MAILGUN_INGRESS_SIGNING_KEY"]
|
95
81
|
end
|
96
82
|
|
97
83
|
class Authenticator
|
@@ -22,7 +22,7 @@ module Rails
|
|
22
22
|
def new_mail
|
23
23
|
Mail.new(mail_params.except(:attachments).to_h).tap do |mail|
|
24
24
|
mail[:bcc]&.include_in_headers = true
|
25
|
-
mail_params[:attachments]
|
25
|
+
mail_params[:attachments]&.select(&:present?)&.each do |attachment|
|
26
26
|
mail.add_file(filename: attachment.original_filename, content: attachment.read)
|
27
27
|
end
|
28
28
|
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
# Incinerating will destroy an email that is due and has already been processed.
|
5
|
+
class Conductor::ActionMailbox::IncineratesController < Rails::Conductor::BaseController
|
6
|
+
def create
|
7
|
+
ActionMailbox::InboundEmail.find(params[:inbound_email_id]).incinerate
|
8
|
+
|
9
|
+
redirect_to main_app.rails_conductor_inbound_emails_url
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -14,12 +14,11 @@ module ActionMailbox::InboundEmail::MessageId
|
|
14
14
|
# attachment called +raw_email+. Before the upload, extract the Message-ID from the +source+ and set
|
15
15
|
# it as an attribute on the new +InboundEmail+.
|
16
16
|
def create_and_extract_message_id!(source, **options)
|
17
|
-
message_checksum = Digest::SHA1.hexdigest(source)
|
17
|
+
message_checksum = OpenSSL::Digest::SHA1.hexdigest(source)
|
18
18
|
message_id = extract_message_id(source) || generate_missing_message_id(message_checksum)
|
19
19
|
|
20
|
-
create!
|
21
|
-
|
22
|
-
end
|
20
|
+
create! raw_email: create_and_upload_raw_email!(source),
|
21
|
+
message_id: message_id, message_checksum: message_checksum, **options
|
23
22
|
rescue ActiveRecord::RecordNotUnique
|
24
23
|
nil
|
25
24
|
end
|
@@ -34,5 +33,10 @@ module ActionMailbox::InboundEmail::MessageId
|
|
34
33
|
logger.warn "Message-ID couldn't be parsed or is missing. Generated a new Message-ID: #{message_id}"
|
35
34
|
end
|
36
35
|
end
|
36
|
+
|
37
|
+
def create_and_upload_raw_email!(source)
|
38
|
+
ActiveStorage::Blob.create_and_upload! io: StringIO.new(source), filename: "message.eml", content_type: "message/rfc822",
|
39
|
+
service_name: ActionMailbox.storage_service
|
40
|
+
end
|
37
41
|
end
|
38
42
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "mail"
|
4
4
|
|
5
5
|
module ActionMailbox
|
6
6
|
# The +InboundEmail+ is an Active Record that keeps a reference to the raw email stored in Active Storage
|
@@ -29,7 +29,7 @@ module ActionMailbox
|
|
29
29
|
|
30
30
|
include Incineratable, MessageId, Routable
|
31
31
|
|
32
|
-
has_one_attached :raw_email
|
32
|
+
has_one_attached :raw_email, service: ActionMailbox.storage_service
|
33
33
|
enum status: %i[ pending processing delivered failed bounced ]
|
34
34
|
|
35
35
|
def mail
|
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
<ul>
|
6
6
|
<li><%= button_to "Route again", main_app.rails_conductor_inbound_email_reroute_path(@inbound_email), method: :post %></li>
|
7
|
-
<li
|
7
|
+
<li><%= button_to "Incinerate", main_app.rails_conductor_inbound_email_incinerate_path(@inbound_email), method: :post %></li>
|
8
8
|
</ul>
|
9
9
|
|
10
10
|
<details>
|
data/config/routes.rb
CHANGED
@@ -21,5 +21,6 @@ Rails.application.routes.draw do
|
|
21
21
|
post "inbound_emails/sources", to: "inbound_emails/sources#create", as: :rails_conductor_inbound_email_sources
|
22
22
|
|
23
23
|
post ":inbound_email_id/reroute" => "reroutes#create", as: :rails_conductor_inbound_email_reroute
|
24
|
+
post ":inbound_email_id/incinerate" => "incinerates#create", as: :rails_conductor_inbound_email_incinerate
|
24
25
|
end
|
25
26
|
end
|
data/lib/action_mailbox/base.rb
CHANGED
@@ -27,7 +27,7 @@ module ActionMailbox
|
|
27
27
|
# routing :all => :backstop
|
28
28
|
# end
|
29
29
|
#
|
30
|
-
# Application mailboxes need to
|
30
|
+
# Application mailboxes need to override the #process method, which is invoked by the framework after
|
31
31
|
# callbacks have been run. The callbacks available are: +before_processing+, +after_processing+, and
|
32
32
|
# +around_processing+. The primary use case is ensure certain preconditions to processing are fulfilled
|
33
33
|
# using +before_processing+ callbacks.
|
@@ -35,7 +35,7 @@ module ActionMailbox
|
|
35
35
|
# If a precondition fails to be met, you can halt the processing using the +#bounced!+ method,
|
36
36
|
# which will silently prevent any further processing, but not actually send out any bounce notice. You
|
37
37
|
# can also pair this behavior with the invocation of an Action Mailer class responsible for sending out
|
38
|
-
# an actual bounce email. This is done using the
|
38
|
+
# an actual bounce email. This is done using the #bounce_with method, which takes the mail object returned
|
39
39
|
# by an Action Mailer method, like so:
|
40
40
|
#
|
41
41
|
# class ForwardsMailbox < ApplicationMailbox
|
@@ -51,11 +51,12 @@ module ActionMailbox
|
|
51
51
|
#
|
52
52
|
# During the processing of the inbound email, the status will be tracked. Before processing begins,
|
53
53
|
# the email will normally have the +pending+ status. Once processing begins, just before callbacks
|
54
|
-
# and the
|
54
|
+
# and the #process method is called, the status is changed to +processing+. If processing is allowed to
|
55
55
|
# complete, the status is changed to +delivered+. If a bounce is triggered, then +bounced+. If an unhandled
|
56
56
|
# exception is bubbled up, then +failed+.
|
57
57
|
#
|
58
|
-
# Exceptions can be handled at the class level using the familiar
|
58
|
+
# Exceptions can be handled at the class level using the familiar
|
59
|
+
# ActiveSupport::Rescuable approach:
|
59
60
|
#
|
60
61
|
# class ForwardsMailbox < ApplicationMailbox
|
61
62
|
# rescue_from(ApplicationSpecificVerificationError) { bounced! }
|
@@ -77,7 +78,7 @@ module ActionMailbox
|
|
77
78
|
@inbound_email = inbound_email
|
78
79
|
end
|
79
80
|
|
80
|
-
def perform_processing
|
81
|
+
def perform_processing # :nodoc:
|
81
82
|
track_status_of_inbound_email do
|
82
83
|
run_callbacks :process do
|
83
84
|
process
|
@@ -89,10 +90,10 @@ module ActionMailbox
|
|
89
90
|
end
|
90
91
|
|
91
92
|
def process
|
92
|
-
#
|
93
|
+
# Override in subclasses
|
93
94
|
end
|
94
95
|
|
95
|
-
def finished_processing?
|
96
|
+
def finished_processing? # :nodoc:
|
96
97
|
inbound_email.delivered? || inbound_email.bounced?
|
97
98
|
end
|
98
99
|
|
@@ -20,6 +20,8 @@ module ActionMailbox
|
|
20
20
|
config.action_mailbox.queues = ActiveSupport::InheritableOptions.new \
|
21
21
|
incineration: :action_mailbox_incineration, routing: :action_mailbox_routing
|
22
22
|
|
23
|
+
config.action_mailbox.storage_service = nil
|
24
|
+
|
23
25
|
initializer "action_mailbox.config" do
|
24
26
|
config.after_initialize do |app|
|
25
27
|
ActionMailbox.logger = app.config.action_mailbox.logger || Rails.logger
|
@@ -27,6 +29,7 @@ module ActionMailbox
|
|
27
29
|
ActionMailbox.incinerate_after = app.config.action_mailbox.incinerate_after || 30.days
|
28
30
|
ActionMailbox.queues = app.config.action_mailbox.queues || {}
|
29
31
|
ActionMailbox.ingress = app.config.action_mailbox.ingress
|
32
|
+
ActionMailbox.storage_service = app.config.action_mailbox.storage_service
|
30
33
|
end
|
31
34
|
end
|
32
35
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
module ActionMailbox
|
4
|
-
# Returns the currently
|
4
|
+
# Returns the currently loaded version of Action Mailbox as a <tt>Gem::Version</tt>.
|
5
5
|
def self.gem_version
|
6
6
|
Gem::Version.new VERSION::STRING
|
7
7
|
end
|
8
8
|
|
9
9
|
module VERSION
|
10
|
-
MAJOR =
|
11
|
-
MINOR =
|
12
|
-
TINY =
|
13
|
-
PRE = "
|
10
|
+
MAJOR = 7
|
11
|
+
MINOR = 0
|
12
|
+
TINY = 8
|
13
|
+
PRE = "4"
|
14
14
|
|
15
15
|
STRING = [MAJOR, MINOR, TINY, PRE].compact.join(".")
|
16
16
|
end
|
@@ -3,7 +3,7 @@
|
|
3
3
|
module Mail
|
4
4
|
class Message
|
5
5
|
def from_address
|
6
|
-
header[:from]&.
|
6
|
+
address_list(header[:from])&.addresses&.first
|
7
7
|
end
|
8
8
|
|
9
9
|
def recipients_addresses
|
@@ -11,19 +11,30 @@ module Mail
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def to_addresses
|
14
|
-
Array(header[:to]&.
|
14
|
+
Array(address_list(header[:to])&.addresses)
|
15
15
|
end
|
16
16
|
|
17
17
|
def cc_addresses
|
18
|
-
Array(header[:cc]&.
|
18
|
+
Array(address_list(header[:cc])&.addresses)
|
19
19
|
end
|
20
20
|
|
21
21
|
def bcc_addresses
|
22
|
-
Array(header[:bcc]&.
|
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
|
+
private
|
30
|
+
def address_list(obj)
|
31
|
+
if obj&.respond_to?(:element)
|
32
|
+
# Mail 2.8+
|
33
|
+
obj.element
|
34
|
+
else
|
35
|
+
# Mail <= 2.7.x
|
36
|
+
obj&.address_list
|
37
|
+
end
|
38
|
+
end
|
28
39
|
end
|
29
40
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require "
|
3
|
+
require "mail"
|
4
4
|
|
5
5
|
# The hope is to upstream most of these basic additions to the Mail gem's Mail object. But until then, here they lay!
|
6
6
|
Dir["#{File.expand_path(File.dirname(__FILE__))}/mail_ext/*"].each { |path| require "action_mailbox/mail_ext/#{File.basename(path)}" }
|
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
module ActionMailbox
|
4
4
|
# Encapsulates a route, which can then be matched against an inbound_email and provide a lookup of the matching
|
5
|
-
# mailbox class. See examples for the different route addresses and how to use them in the
|
5
|
+
# mailbox class. See examples for the different route addresses and how to use them in the ActionMailbox::Base
|
6
6
|
# documentation.
|
7
7
|
class Router::Route
|
8
8
|
attr_reader :address, :mailbox_name
|
@@ -4,18 +4,18 @@ require "mail"
|
|
4
4
|
|
5
5
|
module ActionMailbox
|
6
6
|
module TestHelper
|
7
|
-
# Create an
|
7
|
+
# Create an InboundEmail record using an eml fixture in the format of message/rfc822
|
8
8
|
# referenced with +fixture_name+ located in +test/fixtures/files/fixture_name+.
|
9
9
|
def create_inbound_email_from_fixture(fixture_name, status: :processing)
|
10
10
|
create_inbound_email_from_source file_fixture(fixture_name).read, status: status
|
11
11
|
end
|
12
12
|
|
13
|
-
# Creates an
|
13
|
+
# Creates an InboundEmail by specifying through options or a block.
|
14
14
|
#
|
15
15
|
# ==== Options
|
16
16
|
#
|
17
|
-
# * <tt>:status</tt> - The +status+ to set for the created
|
18
|
-
# For possible statuses, see
|
17
|
+
# * <tt>:status</tt> - The +status+ to set for the created InboundEmail.
|
18
|
+
# For possible statuses, see its documentation.
|
19
19
|
#
|
20
20
|
# ==== Creating a simple email
|
21
21
|
#
|
@@ -68,26 +68,25 @@ module ActionMailbox
|
|
68
68
|
create_inbound_email_from_source mail.to_s, status: status
|
69
69
|
end
|
70
70
|
|
71
|
-
# Create an
|
71
|
+
# Create an InboundEmail using the raw rfc822 +source+ as text.
|
72
72
|
def create_inbound_email_from_source(source, status: :processing)
|
73
73
|
ActionMailbox::InboundEmail.create_and_extract_message_id! source, status: status
|
74
74
|
end
|
75
75
|
|
76
76
|
|
77
|
-
# Create an
|
77
|
+
# Create an InboundEmail from fixture using the same arguments as create_inbound_email_from_fixture
|
78
78
|
# and immediately route it to processing.
|
79
79
|
def receive_inbound_email_from_fixture(*args)
|
80
80
|
create_inbound_email_from_fixture(*args).tap(&:route)
|
81
81
|
end
|
82
82
|
|
83
|
-
# Create an
|
84
|
-
#
|
85
|
-
# then immediately route it for processing.
|
83
|
+
# Create an InboundEmail using the same options or block as
|
84
|
+
# create_inbound_email_from_mail, then immediately route it for processing.
|
86
85
|
def receive_inbound_email_from_mail(**kwargs, &block)
|
87
86
|
create_inbound_email_from_mail(**kwargs, &block).tap(&:route)
|
88
87
|
end
|
89
88
|
|
90
|
-
# Create an
|
89
|
+
# Create an InboundEmail using the same arguments as create_inbound_email_from_source and immediately route it
|
91
90
|
# to processing.
|
92
91
|
def receive_inbound_email_from_source(*args)
|
93
92
|
create_inbound_email_from_source(*args).tap(&:route)
|
@@ -3,7 +3,7 @@
|
|
3
3
|
require_relative "gem_version"
|
4
4
|
|
5
5
|
module ActionMailbox
|
6
|
-
# Returns the currently
|
6
|
+
# Returns the currently loaded version of Action Mailbox as a <tt>Gem::Version</tt>.
|
7
7
|
def self.version
|
8
8
|
gem_version
|
9
9
|
end
|
data/lib/action_mailbox.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmailbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 7.0.8.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -17,70 +17,70 @@ dependencies:
|
|
17
17
|
requirements:
|
18
18
|
- - '='
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version:
|
20
|
+
version: 7.0.8.4
|
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:
|
27
|
+
version: 7.0.8.4
|
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:
|
34
|
+
version: 7.0.8.4
|
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:
|
41
|
+
version: 7.0.8.4
|
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:
|
48
|
+
version: 7.0.8.4
|
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:
|
55
|
+
version: 7.0.8.4
|
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:
|
62
|
+
version: 7.0.8.4
|
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:
|
69
|
+
version: 7.0.8.4
|
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:
|
76
|
+
version: 7.0.8.4
|
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:
|
83
|
+
version: 7.0.8.4
|
84
84
|
- !ruby/object:Gem::Dependency
|
85
85
|
name: mail
|
86
86
|
requirement: !ruby/object:Gem::Requirement
|
@@ -95,6 +95,48 @@ dependencies:
|
|
95
95
|
- - ">="
|
96
96
|
- !ruby/object:Gem::Version
|
97
97
|
version: 2.7.1
|
98
|
+
- !ruby/object:Gem::Dependency
|
99
|
+
name: net-imap
|
100
|
+
requirement: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '0'
|
105
|
+
type: :runtime
|
106
|
+
prerelease: false
|
107
|
+
version_requirements: !ruby/object:Gem::Requirement
|
108
|
+
requirements:
|
109
|
+
- - ">="
|
110
|
+
- !ruby/object:Gem::Version
|
111
|
+
version: '0'
|
112
|
+
- !ruby/object:Gem::Dependency
|
113
|
+
name: net-pop
|
114
|
+
requirement: !ruby/object:Gem::Requirement
|
115
|
+
requirements:
|
116
|
+
- - ">="
|
117
|
+
- !ruby/object:Gem::Version
|
118
|
+
version: '0'
|
119
|
+
type: :runtime
|
120
|
+
prerelease: false
|
121
|
+
version_requirements: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
- !ruby/object:Gem::Dependency
|
127
|
+
name: net-smtp
|
128
|
+
requirement: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
type: :runtime
|
134
|
+
prerelease: false
|
135
|
+
version_requirements: !ruby/object:Gem::Requirement
|
136
|
+
requirements:
|
137
|
+
- - ">="
|
138
|
+
- !ruby/object:Gem::Version
|
139
|
+
version: '0'
|
98
140
|
description: Receive and process incoming emails in Rails applications.
|
99
141
|
email:
|
100
142
|
- david@loudthinking.com
|
@@ -114,6 +156,7 @@ files:
|
|
114
156
|
- app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
|
115
157
|
- app/controllers/rails/conductor/action_mailbox/inbound_emails/sources_controller.rb
|
116
158
|
- app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
|
159
|
+
- app/controllers/rails/conductor/action_mailbox/incinerates_controller.rb
|
117
160
|
- app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb
|
118
161
|
- app/controllers/rails/conductor/base_controller.rb
|
119
162
|
- app/jobs/action_mailbox/incineration_job.rb
|
@@ -142,7 +185,6 @@ files:
|
|
142
185
|
- lib/action_mailbox/mail_ext/addresses.rb
|
143
186
|
- lib/action_mailbox/mail_ext/from_source.rb
|
144
187
|
- lib/action_mailbox/mail_ext/recipients.rb
|
145
|
-
- lib/action_mailbox/mail_with_error_handling.rb
|
146
188
|
- lib/action_mailbox/relayer.rb
|
147
189
|
- lib/action_mailbox/router.rb
|
148
190
|
- lib/action_mailbox/router/route.rb
|
@@ -164,10 +206,10 @@ licenses:
|
|
164
206
|
- MIT
|
165
207
|
metadata:
|
166
208
|
bug_tracker_uri: https://github.com/rails/rails/issues
|
167
|
-
changelog_uri: https://github.com/rails/rails/blob/
|
168
|
-
documentation_uri: https://api.rubyonrails.org/
|
209
|
+
changelog_uri: https://github.com/rails/rails/blob/v7.0.8.4/actionmailbox/CHANGELOG.md
|
210
|
+
documentation_uri: https://api.rubyonrails.org/v7.0.8.4/
|
169
211
|
mailing_list_uri: https://discuss.rubyonrails.org/c/rubyonrails-talk
|
170
|
-
source_code_uri: https://github.com/rails/rails/tree/
|
212
|
+
source_code_uri: https://github.com/rails/rails/tree/v7.0.8.4/actionmailbox
|
171
213
|
rubygems_mfa_required: 'true'
|
172
214
|
post_install_message:
|
173
215
|
rdoc_options: []
|
@@ -177,7 +219,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
177
219
|
requirements:
|
178
220
|
- - ">="
|
179
221
|
- !ruby/object:Gem::Version
|
180
|
-
version: 2.
|
222
|
+
version: 2.7.0
|
181
223
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
224
|
requirements:
|
183
225
|
- - ">="
|
@@ -1,10 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
begin
|
4
|
-
require "mail"
|
5
|
-
rescue LoadError => error
|
6
|
-
if error.message.match?(/net\/smtp/)
|
7
|
-
$stderr.puts "You don't have net-smtp installed in your application. Please add it to your Gemfile and run bundle install"
|
8
|
-
raise
|
9
|
-
end
|
10
|
-
end
|