mail_plugger 1.0.0.beta1 → 1.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +54 -0
- data/README.md +35 -4
- data/lib/fake_plugger/delivery_method.rb +164 -0
- data/lib/fake_plugger/railtie.rb +14 -0
- data/lib/mail_plugger.rb +47 -28
- data/lib/mail_plugger/delivery_method.rb +42 -5
- data/lib/mail_plugger/mail_helper.rb +41 -18
- data/lib/mail_plugger/version.rb +1 -1
- metadata +16 -35
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -22
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -16
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.rubocop.yml +0 -50
- data/.travis.yml +0 -22
- data/Appraisals +0 -13
- data/CODE_OF_CONDUCT.md +0 -14
- data/CONTRIBUTING.md +0 -26
- data/Gemfile +0 -19
- data/Gemfile.lock +0 -92
- data/Rakefile +0 -11
- data/bin/console +0 -17
- data/bin/setup +0 -8
- data/docs/usage_in_ruby_on_rails.md +0 -182
- data/docs/usage_in_script_or_console.md +0 -158
- data/gemfiles/.bundle/config +0 -2
- data/gemfiles/mail_2.6.gemfile +0 -15
- data/gemfiles/mail_2.6.gemfile.lock +0 -95
- data/gemfiles/mail_2.7.0.gemfile +0 -15
- data/gemfiles/mail_2.7.0.gemfile.lock +0 -93
- data/gemfiles/mail_2.7.gemfile +0 -15
- data/gemfiles/mail_2.7.gemfile.lock +0 -93
- data/images/mail_plugger.png +0 -0
- data/mail_plugger.gemspec +0 -39
data/Rakefile
DELETED
data/bin/console
DELETED
@@ -1,17 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
# frozen_string_literal: true
|
4
|
-
|
5
|
-
require 'bundler/setup'
|
6
|
-
require 'mail_plugger'
|
7
|
-
require 'mail'
|
8
|
-
|
9
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
10
|
-
# with your gem easier. You can also use a different console, if you like.
|
11
|
-
|
12
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
13
|
-
# require "pry"
|
14
|
-
# Pry.start
|
15
|
-
|
16
|
-
require 'irb'
|
17
|
-
IRB.start(__FILE__)
|
data/bin/setup
DELETED
@@ -1,182 +0,0 @@
|
|
1
|
-
## Use MailPlugger in Ruby on Rails
|
2
|
-
|
3
|
-
After to add `mail_plugger` gem and the gem of API of the mail provider, create `config/initializers/mail_plugger.rb` file and add something similar.
|
4
|
-
|
5
|
-
```ruby
|
6
|
-
# NOTE: This is just an example for testing...
|
7
|
-
class TestApiClientClass
|
8
|
-
def initialize(options = {})
|
9
|
-
@settings = { api_key: '12345' }
|
10
|
-
@options = options
|
11
|
-
end
|
12
|
-
|
13
|
-
def deliver
|
14
|
-
# e.g. API.new(@settings).client.post(generate_mail_hash)
|
15
|
-
puts " >>> settings: #{@settings.inspect}"
|
16
|
-
puts " >>> options: #{@options.inspect}"
|
17
|
-
puts " >>> generate_mail_hash: #{generate_mail_hash.inspect}"
|
18
|
-
{ response: 'OK' }
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def generate_mail_hash
|
24
|
-
{
|
25
|
-
to: generate_recipients,
|
26
|
-
from: {
|
27
|
-
email: @options[:from].first
|
28
|
-
},
|
29
|
-
subject: @options[:subject],
|
30
|
-
content: [
|
31
|
-
{
|
32
|
-
type: 'text/plain',
|
33
|
-
value: @options[:text_part]
|
34
|
-
},
|
35
|
-
{
|
36
|
-
type: 'text/html; charset=UTF-8',
|
37
|
-
value: @options[:html_part]
|
38
|
-
}
|
39
|
-
]
|
40
|
-
}
|
41
|
-
end
|
42
|
-
|
43
|
-
def generate_recipients
|
44
|
-
@options[:to].map do |to|
|
45
|
-
{
|
46
|
-
email: to
|
47
|
-
}
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
|
52
|
-
MailPlugger.plug_in('test_api_client') do |api|
|
53
|
-
api.delivery_options = %i[from to subject text_part html_part]
|
54
|
-
api.client = TestApiClientClass
|
55
|
-
end
|
56
|
-
```
|
57
|
-
|
58
|
-
Then change `config/application.rb` file.
|
59
|
-
|
60
|
-
```ruby
|
61
|
-
config.action_mailer.delivery_method = :mail_plugger
|
62
|
-
```
|
63
|
-
|
64
|
-
So now we should add a mailer method. Let's create `app/mailers/test_mailer.rb` file.
|
65
|
-
|
66
|
-
```ruby
|
67
|
-
class TestMailer < ApplicationMailer
|
68
|
-
default from: 'from@example.com'
|
69
|
-
|
70
|
-
def send_test
|
71
|
-
mail subject: 'Test email', to: 'to@example.com'
|
72
|
-
end
|
73
|
-
end
|
74
|
-
```
|
75
|
-
|
76
|
-
Then we should add views (the body) of this email, so create `app/views/test_mailer/send_test.html.erb`
|
77
|
-
|
78
|
-
```erb
|
79
|
-
<p>Test email body</p>
|
80
|
-
```
|
81
|
-
|
82
|
-
and `app/views/test_mailer/send_test.text.erb`.
|
83
|
-
|
84
|
-
```erb
|
85
|
-
Test email body
|
86
|
-
```
|
87
|
-
|
88
|
-
In the `rails console` we can try it out.
|
89
|
-
|
90
|
-
```ruby
|
91
|
-
TestMailer.send_test.deliver_now
|
92
|
-
# Rendering test_mailer/send_test.html.erb within layouts/mailer
|
93
|
-
# Rendered test_mailer/send_test.html.erb within layouts/mailer (1.3ms)
|
94
|
-
# Rendering test_mailer/send_test.text.erb within layouts/mailer
|
95
|
-
# Rendered test_mailer/send_test.text.erb within layouts/mailer (0.5ms)
|
96
|
-
#TestMailer#send_test: processed outbound mail in 62.2ms
|
97
|
-
# >>> settings: {:api_key=>"12345"}
|
98
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :text_part=>"Test email body\n\n", :html_part=>"<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <style>\n /* Email styles need to be inline */\n </style>\n </head>\n\n <body>\n <p>Test email body</p>\n\n </body>\n</html>\n"}
|
99
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body\n\n"}, {:type=>"text/html; charset=UTF-8", :value=>"<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <style>\n /* Email styles need to be inline */\n </style>\n </head>\n\n <body>\n <p>Test email body</p>\n\n </body>\n</html>\n"}]}
|
100
|
-
#Sent mail to to@example.com (12.2ms)
|
101
|
-
#Date: Sat, 02 Jan 2021 15:08:53 +0100
|
102
|
-
#From: from@example.com
|
103
|
-
#To: to@example.com
|
104
|
-
#Message-ID: <5ff07e7597b40_104cfebb4988d3@100S-Mac.local.mail>
|
105
|
-
#Subject: Test email
|
106
|
-
#Mime-Version: 1.0
|
107
|
-
#Content-Type: multipart/alternative;
|
108
|
-
# boundary="--==_mimepart_5ff07e75956a7_104cfebb498739";
|
109
|
-
# charset=UTF-8
|
110
|
-
#Content-Transfer-Encoding: 7bit
|
111
|
-
#
|
112
|
-
#
|
113
|
-
#----==_mimepart_5ff07e75956a7_104cfebb498739
|
114
|
-
#Content-Type: text/plain;
|
115
|
-
# charset=UTF-8
|
116
|
-
#Content-Transfer-Encoding: 7bit
|
117
|
-
#
|
118
|
-
#Test email body
|
119
|
-
#
|
120
|
-
#
|
121
|
-
#----==_mimepart_5ff07e75956a7_104cfebb498739
|
122
|
-
#Content-Type: text/html;
|
123
|
-
# charset=UTF-8
|
124
|
-
#Content-Transfer-Encoding: 7bit
|
125
|
-
#
|
126
|
-
#<!DOCTYPE html>
|
127
|
-
#<html>
|
128
|
-
# <head>
|
129
|
-
# <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
130
|
-
# <style>
|
131
|
-
# /* Email styles need to be inline */
|
132
|
-
# </style>
|
133
|
-
# </head>
|
134
|
-
#
|
135
|
-
# <body>
|
136
|
-
# <p>Test email body</p>
|
137
|
-
#
|
138
|
-
# </body>
|
139
|
-
#</html>
|
140
|
-
#
|
141
|
-
#----==_mimepart_5ff07e75956a7_104cfebb498739--
|
142
|
-
|
143
|
-
#=> #<Mail::Message:61100, Multipart: true, Headers: <Date: Sat, 02 Jan 2021 15:08:53 +0100>, <From: from@example.com>, <To: to@example.com>, <Message-ID: <5ff07e7597b40_104cfebb4988d3@100S-Mac.local.mail>>, <Subject: Test email>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="--==_mimepart_5ff07e75956a7_104cfebb498739"; charset=UTF-8>, <Content-Transfer-Encoding: 7bit>>
|
144
|
-
|
145
|
-
# or use ! to not render mail
|
146
|
-
|
147
|
-
TestMailer.send_test.deliver_now!
|
148
|
-
# Rendering test_mailer/send_test.html.erb within layouts/mailer
|
149
|
-
# Rendered test_mailer/send_test.html.erb within layouts/mailer (0.1ms)
|
150
|
-
# Rendering test_mailer/send_test.text.erb within layouts/mailer
|
151
|
-
# Rendered test_mailer/send_test.text.erb within layouts/mailer (0.0ms)
|
152
|
-
#TestMailer#send_test: processed outbound mail in 20.9ms
|
153
|
-
# >>> settings: {:api_key=>"12345"}
|
154
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :text_part=>"Test email body\n\n", :html_part=>"<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <style>\n /* Email styles need to be inline */\n </style>\n </head>\n\n <body>\n <p>Test email body</p>\n\n </body>\n</html>\n"}
|
155
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body\n\n"}, {:type=>"text/html; charset=UTF-8", :value=>"<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <style>\n /* Email styles need to be inline */\n </style>\n </head>\n\n <body>\n <p>Test email body</p>\n\n </body>\n</html>\n"}]}
|
156
|
-
#=> #<Mail::Message:61140, Multipart: true, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Test email>, <Mime-Version: 1.0>, <Content-Type: multipart/alternative; boundary="--==_mimepart_5ff082bd7aab5_10afcebb4503a4"; charset=UTF-8>>
|
157
|
-
```
|
158
|
-
|
159
|
-
Let's add delivery settings as well in `config/initializers/mail_plugger.rb`.
|
160
|
-
|
161
|
-
```ruby
|
162
|
-
MailPlugger.plug_in('test_api_client') do |api|
|
163
|
-
api.delivery_options = %i[from to subject text_part html_part]
|
164
|
-
api.delivery_settings = { return_response: true }
|
165
|
-
api.client = TestApiClientClass
|
166
|
-
end
|
167
|
-
```
|
168
|
-
|
169
|
-
Then in the `rails console`.
|
170
|
-
|
171
|
-
```ruby
|
172
|
-
TestMailer.send_test.deliver_now!
|
173
|
-
# Rendering test_mailer/send_test.html.erb within layouts/mailer
|
174
|
-
# Rendered test_mailer/send_test.html.erb within layouts/mailer (0.8ms)
|
175
|
-
# Rendering test_mailer/send_test.text.erb within layouts/mailer
|
176
|
-
# Rendered test_mailer/send_test.text.erb within layouts/mailer (0.4ms)
|
177
|
-
#TestMailer#send_test: processed outbound mail in 37.0ms
|
178
|
-
# >>> settings: {:api_key=>"12345"}
|
179
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :text_part=>"Test email body\n\n", :html_part=>"<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <style>\n /* Email styles need to be inline */\n </style>\n </head>\n\n <body>\n <p>Test email body</p>\n\n </body>\n</html>\n"}
|
180
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body\n\n"}, {:type=>"text/html; charset=UTF-8", :value=>"<!DOCTYPE html>\n<html>\n <head>\n <meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" />\n <style>\n /* Email styles need to be inline */\n </style>\n </head>\n\n <body>\n <p>Test email body</p>\n\n </body>\n</html>\n"}]}
|
181
|
-
#=> {:response=>"OK"}
|
182
|
-
```
|
@@ -1,158 +0,0 @@
|
|
1
|
-
## Use MailPlugger in a Ruby script or IRB console
|
2
|
-
|
3
|
-
First you should be able to `require 'mail'` and `require 'mail_plugger'` to get started.
|
4
|
-
|
5
|
-
We need a class which will send the message in the right format via API.
|
6
|
-
|
7
|
-
```ruby
|
8
|
-
# NOTE: This is just an example for testing...
|
9
|
-
class TestApiClientClass
|
10
|
-
def initialize(options = {})
|
11
|
-
@settings = { api_key: '12345' }
|
12
|
-
@options = options
|
13
|
-
end
|
14
|
-
|
15
|
-
def deliver
|
16
|
-
# e.g. API.new(@settings).client.post(generate_mail_hash)
|
17
|
-
puts " >>> settings: #{@settings.inspect}"
|
18
|
-
puts " >>> options: #{@options.inspect}"
|
19
|
-
puts " >>> generate_mail_hash: #{generate_mail_hash.inspect}"
|
20
|
-
{ response: 'OK' }
|
21
|
-
end
|
22
|
-
|
23
|
-
private
|
24
|
-
|
25
|
-
def generate_mail_hash
|
26
|
-
{
|
27
|
-
to: generate_recipients,
|
28
|
-
from: {
|
29
|
-
email: @options[:from].first
|
30
|
-
},
|
31
|
-
subject: @options[:subject],
|
32
|
-
content: [
|
33
|
-
{
|
34
|
-
type: 'text/plain',
|
35
|
-
value: @options[:body]
|
36
|
-
}
|
37
|
-
]
|
38
|
-
}
|
39
|
-
end
|
40
|
-
|
41
|
-
def generate_recipients
|
42
|
-
@options[:to].map do |to|
|
43
|
-
{
|
44
|
-
email: to
|
45
|
-
}
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
```
|
50
|
-
|
51
|
-
We can use `MailPlugger.plug_in` to add our configurations.
|
52
|
-
|
53
|
-
```ruby
|
54
|
-
MailPlugger.plug_in('test_api_client') do |api|
|
55
|
-
api.delivery_options = %i[from to subject body]
|
56
|
-
api.client = TestApiClientClass
|
57
|
-
end
|
58
|
-
|
59
|
-
message = Mail.new(from: 'from@example.com', to: 'to@example.com', subject: 'Test email', body: 'Test email body')
|
60
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Tes...
|
61
|
-
|
62
|
-
MailPlugger::DeliveryMethod.new.deliver!(message)
|
63
|
-
# >>> settings: {:api_key=>"12345"}
|
64
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
65
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
66
|
-
# => {:response=>"OK"}
|
67
|
-
```
|
68
|
-
|
69
|
-
Or we can use the `MailPlugger::DeliveryMethod` directly as well.
|
70
|
-
|
71
|
-
```ruby
|
72
|
-
message = Mail.new(from: 'from@example.com', to: 'to@example.com', subject: 'Test email', body: 'Test email body')
|
73
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Tes...
|
74
|
-
|
75
|
-
MailPlugger::DeliveryMethod.new(delivery_options: %i[from to subject body], client: TestApiClientClass).deliver!(message)
|
76
|
-
# >>> settings: {:api_key=>"12345"}
|
77
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
78
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
79
|
-
# => {:response=>"OK"}
|
80
|
-
```
|
81
|
-
|
82
|
-
Or add `MailPlugger::DeliveryMethod` to `mail.delivery_method`.
|
83
|
-
|
84
|
-
```ruby
|
85
|
-
mail = Mail.new(from: 'from@example.com', to: 'to@example.com', subject: 'Test email', body: 'Test email body')
|
86
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Tes...
|
87
|
-
|
88
|
-
mail.delivery_method MailPlugger::DeliveryMethod, { delivery_options: %i[from to subject body], client: TestApiClientClass }
|
89
|
-
# => #<MailPlugger::DeliveryMethod:0x00007fecbbb2ca00 @delivery_options=[:from, :to, :subject, :body], @client=TestApiClientClass, @default_delivery_system=nil, @delivery_settings=nil, @message=nil>
|
90
|
-
|
91
|
-
mail.deliver
|
92
|
-
# >>> settings: {:api_key=>"12345"}
|
93
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
94
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
95
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Test email>>
|
96
|
-
|
97
|
-
# or
|
98
|
-
|
99
|
-
mail.deliver!
|
100
|
-
# >>> settings: {:api_key=>"12345"}
|
101
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
102
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
103
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Test email>>
|
104
|
-
```
|
105
|
-
|
106
|
-
Let's add delivery settings to the delivery method.
|
107
|
-
|
108
|
-
```ruby
|
109
|
-
mail = Mail.new(from: 'from@example.com', to: 'to@example.com', subject: 'Test email', body: 'Test email body')
|
110
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Tes...
|
111
|
-
|
112
|
-
mail.delivery_method MailPlugger::DeliveryMethod, { delivery_options: %i[from to subject body], client: TestApiClientClass, delivery_settings: { return_response: true } }
|
113
|
-
# => #<MailPlugger::DeliveryMethod:0x00007fecbb9e3630 @delivery_options=[:from, :to, :subject, :body], @client=TestApiClientClass, @default_delivery_system=nil, @delivery_settings={:return_response=>true}, @message=nil>
|
114
|
-
|
115
|
-
mail.deliver
|
116
|
-
# >>> settings: {:api_key=>"12345"}
|
117
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
118
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
119
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Test email>>
|
120
|
-
|
121
|
-
# or
|
122
|
-
|
123
|
-
mail.deliver!
|
124
|
-
# >>> settings: {:api_key=>"12345"}
|
125
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
126
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
127
|
-
# => {:response=>"OK"}
|
128
|
-
```
|
129
|
-
|
130
|
-
Let's use `MailPlugger.plug_in` method.
|
131
|
-
|
132
|
-
```ruby
|
133
|
-
MailPlugger.plug_in('test_api_client') do |api|
|
134
|
-
api.delivery_options = %i[from to subject body]
|
135
|
-
api.delivery_settings = { return_response: true }
|
136
|
-
api.client = TestApiClientClass
|
137
|
-
end
|
138
|
-
|
139
|
-
mail = Mail.new(from: 'from@example.com', to: 'to@example.com', subject: 'Test email', body: 'Test email body')
|
140
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Tes...
|
141
|
-
|
142
|
-
mail.delivery_method MailPlugger::DeliveryMethod
|
143
|
-
# => #<MailPlugger::DeliveryMethod:0x00007ffed930b8f0 @delivery_options={"test_api_client"=>[:from, :to, :subject, :body]}, @client={"test_api_client"=>TestApiClientClass}, @default_delivery_system="test_api_client", @delivery_settings={"test_api_client"=>{:return_response=>true}}, @message=nil>
|
144
|
-
|
145
|
-
mail.deliver
|
146
|
-
# >>> settings: {:api_key=>"12345"}
|
147
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
148
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
149
|
-
# => #<Mail::Message:1960, Multipart: false, Headers: <From: from@example.com>, <To: to@example.com>, <Subject: Test email>>
|
150
|
-
|
151
|
-
# or
|
152
|
-
|
153
|
-
mail.deliver!
|
154
|
-
# >>> settings: {:api_key=>"12345"}
|
155
|
-
# >>> options: {:from=>["from@example.com"], :to=>["to@example.com"], :subject=>"Test email", :body=>"Test email body"}
|
156
|
-
# >>> generate_mail_hash: {:to=>[{:email=>"to@example.com"}], :from=>{:email=>"from@example.com"}, :subject=>"Test email", :content=>[{:type=>"text/plain", :value=>"Test email body"}]}
|
157
|
-
# => {:response=>"OK"}
|
158
|
-
```
|
data/gemfiles/.bundle/config
DELETED
data/gemfiles/mail_2.6.gemfile
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
# This file was generated by Appraisal
|
2
|
-
|
3
|
-
source "https://rubygems.org"
|
4
|
-
|
5
|
-
gem "appraisal"
|
6
|
-
gem "rake", "~> 13.0"
|
7
|
-
gem "rubocop", "~> 1.7", require: false
|
8
|
-
gem "rubocop-performance", require: false
|
9
|
-
gem "rubocop-rspec", require: false
|
10
|
-
gem "rspec", "~> 3.0"
|
11
|
-
gem "simplecov", require: false
|
12
|
-
gem "webmock", "~> 3.0"
|
13
|
-
gem "mail", "~> 2.6.0"
|
14
|
-
|
15
|
-
gemspec path: "../"
|
@@ -1,95 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: ..
|
3
|
-
specs:
|
4
|
-
mail_plugger (0.1.0)
|
5
|
-
mail (~> 2.5)
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.7.0)
|
11
|
-
public_suffix (>= 2.0.2, < 5.0)
|
12
|
-
appraisal (2.3.0)
|
13
|
-
bundler
|
14
|
-
rake
|
15
|
-
thor (>= 0.14.0)
|
16
|
-
ast (2.4.1)
|
17
|
-
crack (0.4.5)
|
18
|
-
rexml
|
19
|
-
diff-lcs (1.4.4)
|
20
|
-
docile (1.3.4)
|
21
|
-
hashdiff (1.0.1)
|
22
|
-
mail (2.6.6)
|
23
|
-
mime-types (>= 1.16, < 4)
|
24
|
-
mime-types (3.3.1)
|
25
|
-
mime-types-data (~> 3.2015)
|
26
|
-
mime-types-data (3.2020.1104)
|
27
|
-
parallel (1.20.1)
|
28
|
-
parser (3.0.0.0)
|
29
|
-
ast (~> 2.4.1)
|
30
|
-
public_suffix (4.0.6)
|
31
|
-
rainbow (3.0.0)
|
32
|
-
rake (13.0.3)
|
33
|
-
regexp_parser (2.0.3)
|
34
|
-
rexml (3.2.4)
|
35
|
-
rspec (3.10.0)
|
36
|
-
rspec-core (~> 3.10.0)
|
37
|
-
rspec-expectations (~> 3.10.0)
|
38
|
-
rspec-mocks (~> 3.10.0)
|
39
|
-
rspec-core (3.10.1)
|
40
|
-
rspec-support (~> 3.10.0)
|
41
|
-
rspec-expectations (3.10.1)
|
42
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
43
|
-
rspec-support (~> 3.10.0)
|
44
|
-
rspec-mocks (3.10.1)
|
45
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
46
|
-
rspec-support (~> 3.10.0)
|
47
|
-
rspec-support (3.10.1)
|
48
|
-
rubocop (1.7.0)
|
49
|
-
parallel (~> 1.10)
|
50
|
-
parser (>= 2.7.1.5)
|
51
|
-
rainbow (>= 2.2.2, < 4.0)
|
52
|
-
regexp_parser (>= 1.8, < 3.0)
|
53
|
-
rexml
|
54
|
-
rubocop-ast (>= 1.2.0, < 2.0)
|
55
|
-
ruby-progressbar (~> 1.7)
|
56
|
-
unicode-display_width (>= 1.4.0, < 2.0)
|
57
|
-
rubocop-ast (1.3.0)
|
58
|
-
parser (>= 2.7.1.5)
|
59
|
-
rubocop-performance (1.9.2)
|
60
|
-
rubocop (>= 0.90.0, < 2.0)
|
61
|
-
rubocop-ast (>= 0.4.0)
|
62
|
-
rubocop-rspec (2.1.0)
|
63
|
-
rubocop (~> 1.0)
|
64
|
-
rubocop-ast (>= 1.1.0)
|
65
|
-
ruby-progressbar (1.11.0)
|
66
|
-
simplecov (0.20.0)
|
67
|
-
docile (~> 1.1)
|
68
|
-
simplecov-html (~> 0.11)
|
69
|
-
simplecov_json_formatter (~> 0.1)
|
70
|
-
simplecov-html (0.12.3)
|
71
|
-
simplecov_json_formatter (0.1.2)
|
72
|
-
thor (1.0.1)
|
73
|
-
unicode-display_width (1.7.0)
|
74
|
-
webmock (3.11.0)
|
75
|
-
addressable (>= 2.3.6)
|
76
|
-
crack (>= 0.3.2)
|
77
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
78
|
-
|
79
|
-
PLATFORMS
|
80
|
-
ruby
|
81
|
-
|
82
|
-
DEPENDENCIES
|
83
|
-
appraisal
|
84
|
-
mail (~> 2.6.0)
|
85
|
-
mail_plugger!
|
86
|
-
rake (~> 13.0)
|
87
|
-
rspec (~> 3.0)
|
88
|
-
rubocop (~> 1.7)
|
89
|
-
rubocop-performance
|
90
|
-
rubocop-rspec
|
91
|
-
simplecov
|
92
|
-
webmock (~> 3.0)
|
93
|
-
|
94
|
-
BUNDLED WITH
|
95
|
-
2.2.3
|