actionmailbox 6.0.2
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.
- checksums.yaml +7 -0
- data/CHANGELOG.md +46 -0
- data/MIT-LICENSE +21 -0
- data/README.md +13 -0
- data/app/controllers/action_mailbox/base_controller.rb +34 -0
- data/app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb +103 -0
- data/app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb +82 -0
- data/app/controllers/action_mailbox/ingresses/postmark/inbound_emails_controller.rb +62 -0
- data/app/controllers/action_mailbox/ingresses/relay/inbound_emails_controller.rb +65 -0
- data/app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb +54 -0
- data/app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb +35 -0
- data/app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb +19 -0
- data/app/controllers/rails/conductor/base_controller.rb +14 -0
- data/app/jobs/action_mailbox/incineration_job.rb +25 -0
- data/app/jobs/action_mailbox/routing_job.rb +13 -0
- data/app/models/action_mailbox/inbound_email.rb +49 -0
- data/app/models/action_mailbox/inbound_email/incineratable.rb +20 -0
- data/app/models/action_mailbox/inbound_email/incineratable/incineration.rb +26 -0
- data/app/models/action_mailbox/inbound_email/message_id.rb +38 -0
- data/app/models/action_mailbox/inbound_email/routable.rb +24 -0
- data/app/views/layouts/rails/conductor.html.erb +8 -0
- data/app/views/rails/conductor/action_mailbox/inbound_emails/index.html.erb +15 -0
- data/app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb +47 -0
- data/app/views/rails/conductor/action_mailbox/inbound_emails/show.html.erb +15 -0
- data/config/routes.rb +19 -0
- data/db/migrate/20180917164000_create_action_mailbox_tables.rb +13 -0
- data/lib/action_mailbox.rb +17 -0
- data/lib/action_mailbox/base.rb +118 -0
- data/lib/action_mailbox/callbacks.rb +34 -0
- data/lib/action_mailbox/engine.rb +33 -0
- data/lib/action_mailbox/gem_version.rb +17 -0
- data/lib/action_mailbox/mail_ext.rb +6 -0
- data/lib/action_mailbox/mail_ext/address_equality.rb +9 -0
- data/lib/action_mailbox/mail_ext/address_wrapping.rb +9 -0
- data/lib/action_mailbox/mail_ext/addresses.rb +29 -0
- data/lib/action_mailbox/mail_ext/from_source.rb +7 -0
- data/lib/action_mailbox/mail_ext/recipients.rb +9 -0
- data/lib/action_mailbox/relayer.rb +75 -0
- data/lib/action_mailbox/router.rb +42 -0
- data/lib/action_mailbox/router/route.rb +42 -0
- data/lib/action_mailbox/routing.rb +22 -0
- data/lib/action_mailbox/test_case.rb +12 -0
- data/lib/action_mailbox/test_helper.rb +48 -0
- data/lib/action_mailbox/version.rb +10 -0
- data/lib/rails/generators/installer.rb +10 -0
- data/lib/rails/generators/mailbox/USAGE +12 -0
- data/lib/rails/generators/mailbox/mailbox_generator.rb +32 -0
- data/lib/rails/generators/mailbox/templates/application_mailbox.rb.tt +3 -0
- data/lib/rails/generators/mailbox/templates/mailbox.rb.tt +4 -0
- data/lib/rails/generators/test_unit/mailbox_generator.rb +20 -0
- data/lib/rails/generators/test_unit/templates/mailbox_test.rb.tt +11 -0
- data/lib/tasks/ingress.rake +72 -0
- data/lib/tasks/install.rake +20 -0
- metadata +186 -0
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Rails
|
4
|
+
module Generators
|
5
|
+
class MailboxGenerator < NamedBase
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
check_class_collision suffix: "Mailbox"
|
9
|
+
|
10
|
+
def create_mailbox_file
|
11
|
+
template "mailbox.rb", File.join("app/mailboxes", class_path, "#{file_name}_mailbox.rb")
|
12
|
+
|
13
|
+
in_root do
|
14
|
+
if behavior == :invoke && !File.exist?(application_mailbox_file_name)
|
15
|
+
template "application_mailbox.rb", application_mailbox_file_name
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
hook_for :test_framework
|
21
|
+
|
22
|
+
private
|
23
|
+
def file_name # :doc:
|
24
|
+
@_file_name ||= super.sub(/_mailbox\z/i, "")
|
25
|
+
end
|
26
|
+
|
27
|
+
def application_mailbox_file_name
|
28
|
+
"app/mailboxes/application_mailbox.rb"
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module TestUnit
|
4
|
+
module Generators
|
5
|
+
class MailboxGenerator < ::Rails::Generators::NamedBase
|
6
|
+
source_root File.expand_path("templates", __dir__)
|
7
|
+
|
8
|
+
check_class_collision suffix: "MailboxTest"
|
9
|
+
|
10
|
+
def create_test_files
|
11
|
+
template "mailbox_test.rb", File.join("test/mailboxes", class_path, "#{file_name}_mailbox_test.rb")
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
def file_name # :doc:
|
16
|
+
@_file_name ||= super.sub(/_mailbox\z/i, "")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "test_helper"
|
2
|
+
|
3
|
+
class <%= class_name %>MailboxTest < ActionMailbox::TestCase
|
4
|
+
# test "receive mail" do
|
5
|
+
# receive_inbound_email_from_mail \
|
6
|
+
# to: '"someone" <someone@example.com>',
|
7
|
+
# from: '"else" <else@example.com>',
|
8
|
+
# subject: "Hello world!",
|
9
|
+
# body: "Hello?"
|
10
|
+
# end
|
11
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :action_mailbox do
|
4
|
+
namespace :ingress do
|
5
|
+
task :environment do
|
6
|
+
require "active_support"
|
7
|
+
require "active_support/core_ext/object/blank"
|
8
|
+
require "action_mailbox/relayer"
|
9
|
+
end
|
10
|
+
|
11
|
+
desc "Relay an inbound email from Exim to Action Mailbox (URL and INGRESS_PASSWORD required)"
|
12
|
+
task exim: "action_mailbox:ingress:environment" do
|
13
|
+
url, password = ENV.values_at("URL", "INGRESS_PASSWORD")
|
14
|
+
|
15
|
+
if url.blank? || password.blank?
|
16
|
+
print "URL and INGRESS_PASSWORD are required"
|
17
|
+
exit 64 # EX_USAGE
|
18
|
+
end
|
19
|
+
|
20
|
+
ActionMailbox::Relayer.new(url: url, password: password).relay(STDIN.read).tap do |result|
|
21
|
+
print result.message
|
22
|
+
|
23
|
+
case
|
24
|
+
when result.success?
|
25
|
+
exit 0
|
26
|
+
when result.transient_failure?
|
27
|
+
exit 75 # EX_TEMPFAIL
|
28
|
+
else
|
29
|
+
exit 69 # EX_UNAVAILABLE
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
desc "Relay an inbound email from Postfix to Action Mailbox (URL and INGRESS_PASSWORD required)"
|
35
|
+
task postfix: "action_mailbox:ingress:environment" do
|
36
|
+
url, password = ENV.values_at("URL", "INGRESS_PASSWORD")
|
37
|
+
|
38
|
+
if url.blank? || password.blank?
|
39
|
+
print "4.3.5 URL and INGRESS_PASSWORD are required"
|
40
|
+
exit 1
|
41
|
+
end
|
42
|
+
|
43
|
+
ActionMailbox::Relayer.new(url: url, password: password).relay(STDIN.read).tap do |result|
|
44
|
+
print "#{result.status_code} #{result.message}"
|
45
|
+
exit result.success?
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
desc "Relay an inbound email from Qmail to Action Mailbox (URL and INGRESS_PASSWORD required)"
|
50
|
+
task qmail: "action_mailbox:ingress:environment" do
|
51
|
+
url, password = ENV.values_at("URL", "INGRESS_PASSWORD")
|
52
|
+
|
53
|
+
if url.blank? || password.blank?
|
54
|
+
print "URL and INGRESS_PASSWORD are required"
|
55
|
+
exit 111
|
56
|
+
end
|
57
|
+
|
58
|
+
ActionMailbox::Relayer.new(url: url, password: password).relay(STDIN.read).tap do |result|
|
59
|
+
print result.message
|
60
|
+
|
61
|
+
case
|
62
|
+
when result.success?
|
63
|
+
exit 0
|
64
|
+
when result.transient_failure?
|
65
|
+
exit 111
|
66
|
+
else
|
67
|
+
exit 100
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :action_mailbox do
|
4
|
+
# Prevent migration installation task from showing up twice.
|
5
|
+
Rake::Task["install:migrations"].clear_comments
|
6
|
+
|
7
|
+
desc "Copy over the migration"
|
8
|
+
task install: %w[ environment run_installer copy_migrations ]
|
9
|
+
|
10
|
+
task :run_installer do
|
11
|
+
installer_template = File.expand_path("../rails/generators/installer.rb", __dir__)
|
12
|
+
system "#{RbConfig.ruby} ./bin/rails app:template LOCATION=#{installer_template}"
|
13
|
+
end
|
14
|
+
|
15
|
+
task :copy_migrations do
|
16
|
+
Rake::Task["active_storage:install:migrations"].invoke
|
17
|
+
Rake::Task["railties:install:migrations"].reenable # Otherwise you can't run 2 migration copy tasks in one invocation
|
18
|
+
Rake::Task["action_mailbox:install:migrations"].invoke
|
19
|
+
end
|
20
|
+
end
|
metadata
ADDED
@@ -0,0 +1,186 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: actionmailbox
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 6.0.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- David Heinemeier Hansson
|
8
|
+
- George Claghorn
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2019-12-13 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: activesupport
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
requirements:
|
18
|
+
- - '='
|
19
|
+
- !ruby/object:Gem::Version
|
20
|
+
version: 6.0.2
|
21
|
+
type: :runtime
|
22
|
+
prerelease: false
|
23
|
+
version_requirements: !ruby/object:Gem::Requirement
|
24
|
+
requirements:
|
25
|
+
- - '='
|
26
|
+
- !ruby/object:Gem::Version
|
27
|
+
version: 6.0.2
|
28
|
+
- !ruby/object:Gem::Dependency
|
29
|
+
name: activerecord
|
30
|
+
requirement: !ruby/object:Gem::Requirement
|
31
|
+
requirements:
|
32
|
+
- - '='
|
33
|
+
- !ruby/object:Gem::Version
|
34
|
+
version: 6.0.2
|
35
|
+
type: :runtime
|
36
|
+
prerelease: false
|
37
|
+
version_requirements: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
39
|
+
- - '='
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
version: 6.0.2
|
42
|
+
- !ruby/object:Gem::Dependency
|
43
|
+
name: activestorage
|
44
|
+
requirement: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - '='
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 6.0.2
|
49
|
+
type: :runtime
|
50
|
+
prerelease: false
|
51
|
+
version_requirements: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
53
|
+
- - '='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: 6.0.2
|
56
|
+
- !ruby/object:Gem::Dependency
|
57
|
+
name: activejob
|
58
|
+
requirement: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - '='
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 6.0.2
|
63
|
+
type: :runtime
|
64
|
+
prerelease: false
|
65
|
+
version_requirements: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
67
|
+
- - '='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: 6.0.2
|
70
|
+
- !ruby/object:Gem::Dependency
|
71
|
+
name: actionpack
|
72
|
+
requirement: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 6.0.2
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - '='
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: 6.0.2
|
84
|
+
- !ruby/object:Gem::Dependency
|
85
|
+
name: mail
|
86
|
+
requirement: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - ">="
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 2.7.1
|
91
|
+
type: :runtime
|
92
|
+
prerelease: false
|
93
|
+
version_requirements: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
95
|
+
- - ">="
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: 2.7.1
|
98
|
+
description: Receive and process incoming emails in Rails applications.
|
99
|
+
email:
|
100
|
+
- david@loudthinking.com
|
101
|
+
- george@basecamp.com
|
102
|
+
executables: []
|
103
|
+
extensions: []
|
104
|
+
extra_rdoc_files: []
|
105
|
+
files:
|
106
|
+
- CHANGELOG.md
|
107
|
+
- MIT-LICENSE
|
108
|
+
- README.md
|
109
|
+
- app/controllers/action_mailbox/base_controller.rb
|
110
|
+
- app/controllers/action_mailbox/ingresses/mailgun/inbound_emails_controller.rb
|
111
|
+
- app/controllers/action_mailbox/ingresses/mandrill/inbound_emails_controller.rb
|
112
|
+
- app/controllers/action_mailbox/ingresses/postmark/inbound_emails_controller.rb
|
113
|
+
- app/controllers/action_mailbox/ingresses/relay/inbound_emails_controller.rb
|
114
|
+
- app/controllers/action_mailbox/ingresses/sendgrid/inbound_emails_controller.rb
|
115
|
+
- app/controllers/rails/conductor/action_mailbox/inbound_emails_controller.rb
|
116
|
+
- app/controllers/rails/conductor/action_mailbox/reroutes_controller.rb
|
117
|
+
- app/controllers/rails/conductor/base_controller.rb
|
118
|
+
- app/jobs/action_mailbox/incineration_job.rb
|
119
|
+
- app/jobs/action_mailbox/routing_job.rb
|
120
|
+
- app/models/action_mailbox/inbound_email.rb
|
121
|
+
- app/models/action_mailbox/inbound_email/incineratable.rb
|
122
|
+
- app/models/action_mailbox/inbound_email/incineratable/incineration.rb
|
123
|
+
- app/models/action_mailbox/inbound_email/message_id.rb
|
124
|
+
- app/models/action_mailbox/inbound_email/routable.rb
|
125
|
+
- app/views/layouts/rails/conductor.html.erb
|
126
|
+
- app/views/rails/conductor/action_mailbox/inbound_emails/index.html.erb
|
127
|
+
- app/views/rails/conductor/action_mailbox/inbound_emails/new.html.erb
|
128
|
+
- app/views/rails/conductor/action_mailbox/inbound_emails/show.html.erb
|
129
|
+
- config/routes.rb
|
130
|
+
- db/migrate/20180917164000_create_action_mailbox_tables.rb
|
131
|
+
- lib/action_mailbox.rb
|
132
|
+
- lib/action_mailbox/base.rb
|
133
|
+
- lib/action_mailbox/callbacks.rb
|
134
|
+
- lib/action_mailbox/engine.rb
|
135
|
+
- lib/action_mailbox/gem_version.rb
|
136
|
+
- lib/action_mailbox/mail_ext.rb
|
137
|
+
- lib/action_mailbox/mail_ext/address_equality.rb
|
138
|
+
- lib/action_mailbox/mail_ext/address_wrapping.rb
|
139
|
+
- lib/action_mailbox/mail_ext/addresses.rb
|
140
|
+
- lib/action_mailbox/mail_ext/from_source.rb
|
141
|
+
- lib/action_mailbox/mail_ext/recipients.rb
|
142
|
+
- lib/action_mailbox/relayer.rb
|
143
|
+
- lib/action_mailbox/router.rb
|
144
|
+
- lib/action_mailbox/router/route.rb
|
145
|
+
- lib/action_mailbox/routing.rb
|
146
|
+
- lib/action_mailbox/test_case.rb
|
147
|
+
- lib/action_mailbox/test_helper.rb
|
148
|
+
- lib/action_mailbox/version.rb
|
149
|
+
- lib/rails/generators/installer.rb
|
150
|
+
- lib/rails/generators/mailbox/USAGE
|
151
|
+
- lib/rails/generators/mailbox/mailbox_generator.rb
|
152
|
+
- lib/rails/generators/mailbox/templates/application_mailbox.rb.tt
|
153
|
+
- lib/rails/generators/mailbox/templates/mailbox.rb.tt
|
154
|
+
- lib/rails/generators/test_unit/mailbox_generator.rb
|
155
|
+
- lib/rails/generators/test_unit/templates/mailbox_test.rb.tt
|
156
|
+
- lib/tasks/ingress.rake
|
157
|
+
- lib/tasks/install.rake
|
158
|
+
homepage: https://rubyonrails.org
|
159
|
+
licenses:
|
160
|
+
- MIT
|
161
|
+
metadata:
|
162
|
+
bug_tracker_uri: https://github.com/rails/rails/issues
|
163
|
+
changelog_uri: https://github.com/rails/rails/blob/v6.0.2/actionmailbox/CHANGELOG.md
|
164
|
+
documentation_uri: https://api.rubyonrails.org/v6.0.2/
|
165
|
+
mailing_list_uri: https://groups.google.com/forum/#!forum/rubyonrails-talk
|
166
|
+
source_code_uri: https://github.com/rails/rails/tree/v6.0.2/actionmailbox
|
167
|
+
post_install_message:
|
168
|
+
rdoc_options: []
|
169
|
+
require_paths:
|
170
|
+
- lib
|
171
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
172
|
+
requirements:
|
173
|
+
- - ">="
|
174
|
+
- !ruby/object:Gem::Version
|
175
|
+
version: 2.5.0
|
176
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
requirements: []
|
182
|
+
rubygems_version: 3.0.3
|
183
|
+
signing_key:
|
184
|
+
specification_version: 4
|
185
|
+
summary: Inbound email handling framework.
|
186
|
+
test_files: []
|