mailgun-ruby 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4cd509b2c1f407b43b66a9ef400bb94845be7bf358ee0516dfc64f8ef9f139b7
4
- data.tar.gz: aad61052482bfb86b04ef0111a4495346d2b48cf046543c1c2fb600ca06916db
3
+ metadata.gz: 58558189e49961ad39adc2090139cfe44158ec4ef56386ce2af0ea1eee0fdaeb
4
+ data.tar.gz: 82445ca2c1f030e2721c49a0a9226ee39b655ca9864a146d95fb0db303a2e6cf
5
5
  SHA512:
6
- metadata.gz: 452423c6da36c0f23ec08d3a613002027fa80c41f48c3b0a8072ccc35df1230d16512273bce584ea470dc9ba05f557e8a5a617a95efe5305e663d2de4f18b54b
7
- data.tar.gz: 5b28c5065060bcff51c7711b0a4b32796fa2c79ef83251fff5a11fbd0a573c80f4d7018b289c42d9a3c273d21941ffd7fa8eee3dcd317bf7463a45fd4131899d
6
+ metadata.gz: d7de45e9c8f998fff873aae0c659e0c67a1cd3e59f5fcb9c28c36cbf0c5d52a798f50fc841b8b704837f9e4981dd41f55e9dc7991ada76ccbb1259aeffdcb7f9
7
+ data.tar.gz: 0dc6b85bcb6517f33c55ee353943e695856d99f2a6b0c7fe956f0f30ecfea3bc436ad962ba676f9780e7bf9959d748ab962f9e6d1c6e9e1a63ae1bb006092f0f
data/CHANGELOG.md CHANGED
@@ -4,6 +4,33 @@ All notable changes to this project will be documented in this file.
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [1.3.2] - 2025-01-30
8
+
9
+ ### Fixed
10
+
11
+ - Use Faraday::FlatParamsEncoder (https://github.com/mailgun/mailgun-ruby/pull/334)
12
+ - Update Message Builder doc (https://github.com/mailgun/mailgun-ruby/pull/338)
13
+ - Add Domain api version warnings (https://github.com/mailgun/mailgun-ruby/pull/339)
14
+
15
+ ## [1.3.1] - 2025-01-26
16
+
17
+ ### Fixed
18
+
19
+ - Fix mock mailgun responds (https://github.com/mailgun/mailgun-ruby/pull/331)
20
+ - Change mime-types to runtime dependency (https://github.com/mailgun/mailgun-ruby/pull/332)
21
+
22
+ ## [1.3.0] - 2025-01-26
23
+
24
+ ### Added
25
+
26
+ - Faraday as http client (https://github.com/mailgun/mailgun-ruby/pull/330)
27
+
28
+ ### Fixed
29
+
30
+ - Added documentation for updating webhook (https://github.com/mailgun/mailgun-ruby/pull/325)
31
+ - Remove duplicated entry from CHANGELOG (https://github.com/mailgun/mailgun-ruby/pull/318)
32
+ - Update template and metrics docs (https://github.com/mailgun/mailgun-ruby/pull/329)
33
+
7
34
  ## [1.2.16] - 2024-11-29
8
35
 
9
36
  ### Added
data/README.md CHANGED
@@ -19,7 +19,7 @@ gem install mailgun-ruby
19
19
  Gemfile:
20
20
 
21
21
  ```ruby
22
- gem 'mailgun-ruby', '~>1.2.16'
22
+ gem 'mailgun-ruby', '~>1.3.2'
23
23
  ```
24
24
 
25
25
  Usage
@@ -181,7 +181,6 @@ For usage examples on each API endpoint, head over to our official documentation
181
181
  pages. Or the [Snippets](docs/Snippets.md) file.
182
182
 
183
183
  This SDK includes the following components:
184
- - [Messages](docs/Messages.md)
185
184
  - [Message Builder](docs/MessageBuilder.md)
186
185
  - [Batch Message](docs/MessageBuilder.md#usage---batch-message)
187
186
  - [Opt-In Handler](docs/OptInHandler.md)
@@ -31,12 +31,18 @@ mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John", "last" =>
31
31
  # Define a cc recipient.
32
32
  mb_obj.add_recipient(:cc, "sally.doe@example.com", {"first" => "Sally", "last" => "Doe"});
33
33
 
34
+ # Define the reply-to address.
35
+ mb_obj.reply_to("bob.doe@example.com", {"first" => "Bob", "last" => "Doe"});
36
+
34
37
  # Define the subject.
35
38
  mb_obj.subject("A message from the Ruby SDK using Message Builder!");
36
39
 
37
40
  # Define the body of the message.
38
41
  mb_obj.body_text("This is the text body of the message!");
39
42
 
43
+ # Define the HTML text of the message
44
+ mb_obj.body_html("<html><body><p>This is the text body of the message</p></body></html>");
45
+
40
46
  # Set the Message-Id header, provide a valid Message-Id.
41
47
  mb_obj.message_id("<20141014000000.11111.11111@example.com>")
42
48
 
@@ -63,6 +69,12 @@ mb_obj.add_inline_image "/path/to/file/header.png"
63
69
  # Schedule message in the future
64
70
  mb_obj.deliver_at("tomorrow 8:00AM PST");
65
71
 
72
+ # Turn Click Tracking on
73
+ mb_obj.track_clicks(true)
74
+
75
+ # Turn Click Tracking off
76
+ mb_obj.track_clicks(false)
77
+
66
78
  # Finally, send your message using the client
67
79
  result = mg_client.send_message("sending_domain.com", mb_obj)
68
80
 
@@ -37,6 +37,7 @@ module Mailgun
37
37
  conn.request :url_encoded
38
38
  conn.response :raise_error, include_request: true
39
39
  conn.adapter Faraday.default_adapter
40
+ conn.options.params_encoder = Faraday::FlatParamsEncoder
40
41
  end
41
42
 
42
43
  @test_mode = test_mode
@@ -19,6 +19,7 @@ module Mailgun
19
19
  #
20
20
  # Returns [Array] A list of domains (hash)
21
21
  def list(options = {})
22
+ warn('WARN: Client api version must be v4') unless @client.api_version == 'v4'
22
23
  @client.get('domains', options).to_h['items']
23
24
  end
24
25
  alias_method :get_domains, :list
@@ -29,6 +30,7 @@ module Mailgun
29
30
  #
30
31
  # Returns [Hash] Information on the requested domains.
31
32
  def info(domain)
33
+ warn('WARN: Client api version must be v4') unless @client.api_version == 'v4'
32
34
  fail(ParameterError, 'No domain given to find on Mailgun', caller) unless domain
33
35
  @client.get("domains/#{domain}").to_h!
34
36
  end
@@ -43,6 +45,7 @@ module Mailgun
43
45
  #
44
46
  # Returns [Hash] Information on the updated/verified domains
45
47
  def verify(domain)
48
+ warn('WARN: Client api version must be v4') unless @client.api_version == 'v4'
46
49
  fail(ParameterError, 'No domain given to verify on Mailgun', caller) unless domain
47
50
  @client.put("domains/#{domain}/verify", nil).to_h!
48
51
  end
@@ -61,6 +64,7 @@ module Mailgun
61
64
  #
62
65
  # Returns [Hash] of created domain
63
66
  def create(domain, options = {})
67
+ warn('WARN: Client api version must be v4') unless @client.api_version == 'v4'
64
68
  fail(ParameterError, 'No domain given to add on Mailgun', caller) unless domain
65
69
  options = { smtp_password: nil, spam_action: 'disabled', wildcard: false }.merge(options)
66
70
  options[:name] = domain
@@ -75,6 +79,7 @@ module Mailgun
75
79
  #
76
80
  # Returns [Boolean] if successful or not
77
81
  def remove(domain)
82
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
78
83
  fail(ParameterError, 'No domain given to remove on Mailgun', caller) unless domain
79
84
  @client.delete("domains/#{domain}").to_h['message'] == 'Domain has been deleted'
80
85
  end
@@ -95,6 +100,7 @@ module Mailgun
95
100
  #
96
101
  # Returns [Hash] of updated domain
97
102
  def update(domain, options = {})
103
+ warn('WARN: Client api version must be v4') unless @client.api_version == 'v4'
98
104
  fail(ParameterError, 'No domain given to update on Mailgun', caller) unless domain
99
105
  @client.put("domains/#{domain}", options).to_h
100
106
  end
@@ -108,6 +114,7 @@ module Mailgun
108
114
  #
109
115
  # Returns [Hash] with message key
110
116
  def create_smtp_credentials(domain, options = {})
117
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
111
118
  fail(ParameterError, 'No domain given to create credentials on Mailgun', caller) unless domain
112
119
  @client.post("domains/#{domain}/credentials", options).to_h
113
120
  end
@@ -121,6 +128,7 @@ module Mailgun
121
128
  #
122
129
  # Returns [Hash] with message key
123
130
  def update_smtp_credentials(domain, login, options = {})
131
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
124
132
  fail(ParameterError, 'No domain given to update credentials on Mailgun', caller) unless domain
125
133
  fail(ParameterError, 'No login given to update credentials on Mailgun', caller) unless login
126
134
  @client.put("domains/#{domain}/credentials/#{login}", options).to_h
@@ -133,6 +141,7 @@ module Mailgun
133
141
  #
134
142
  # Returns [Hash] with message and spec keys
135
143
  def delete_smtp_credentials(domain, login)
144
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
136
145
  fail(ParameterError, 'No domain given to delete credentials on Mailgun', caller) unless domain
137
146
  fail(ParameterError, 'No login given to delete credentials on Mailgun', caller) unless login
138
147
  @client.delete("domains/#{domain}/credentials/#{login}").to_h
@@ -144,6 +153,7 @@ module Mailgun
144
153
  #
145
154
  # Returns [Hash] Information on the delivery connection settings
146
155
  def get_domain_connection_settings(domain)
156
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
147
157
  fail(ParameterError, 'No domain given to retrieve connections on Mailgun', caller) unless domain
148
158
  @client.get("domains/#{domain}/connection").to_h
149
159
  end
@@ -158,6 +168,7 @@ module Mailgun
158
168
  #
159
169
  # Returns [Hash] Information on the delivery connection settings
160
170
  def update_domain_connection_settings(domain, options = {})
171
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
161
172
  fail(ParameterError, 'No domain given to update connections on Mailgun', caller) unless domain
162
173
  @client.put("domains/#{domain}/connection", options).to_h
163
174
  end
@@ -168,6 +179,7 @@ module Mailgun
168
179
  #
169
180
  # Returns [Hash] Information on the tracking settings
170
181
  def get_domain_tracking_settings(domain)
182
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
171
183
  fail(ParameterError, 'No domain given to retrieve tracking settings on Mailgun', caller) unless domain
172
184
  @client.get("domains/#{domain}/tracking").to_h
173
185
  end
@@ -181,6 +193,7 @@ module Mailgun
181
193
  #
182
194
  # Returns [Hash] Information on the tracking open settings
183
195
  def update_domain_tracking_open_settings(domain, options = {})
196
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
184
197
  fail(ParameterError, 'No domain given to update tracking settings on Mailgun', caller) unless domain
185
198
  @client.put("domains/#{domain}/tracking/open", options).to_h
186
199
  end
@@ -193,6 +206,7 @@ module Mailgun
193
206
  #
194
207
  # Returns [Hash] Information on the tracking click settings
195
208
  def update_domain_tracking_click_settings(domain, options = {})
209
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
196
210
  fail(ParameterError, 'No domain given to update tracking settings on Mailgun', caller) unless domain
197
211
  @client.put("domains/#{domain}/tracking/click", options).to_h
198
212
  end
@@ -207,6 +221,7 @@ module Mailgun
207
221
  #
208
222
  # Returns [Hash] Information on the tracking unsubscribe settings
209
223
  def update_domain_tracking_unsubscribe_settings(domain, options = {})
224
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
210
225
  fail(ParameterError, 'No domain given to update tracking settings on Mailgun', caller) unless domain
211
226
  @client.put("domains/#{domain}/tracking/unsubscribe", options).to_h
212
227
  end
@@ -220,6 +235,7 @@ module Mailgun
220
235
  #
221
236
  # Returns [Hash] Information on the DKIM authority
222
237
  def update_domain_dkim_authority(domain, options = {})
238
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
223
239
  fail(ParameterError, 'No domain given to update tracking settings on Mailgun', caller) unless domain
224
240
  @client.put("domains/#{domain}/dkim_authority", options).to_h
225
241
  end
@@ -232,6 +248,7 @@ module Mailgun
232
248
  #
233
249
  # Returns [Hash] with message key
234
250
  def update_domain_dkim_selector(domain, options = {})
251
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
235
252
  fail(ParameterError, 'No domain given to update tracking settings on Mailgun', caller) unless domain
236
253
  @client.put("domains/#{domain}/dkim_selector", options).to_h
237
254
  end
@@ -244,6 +261,7 @@ module Mailgun
244
261
  #
245
262
  # Returns [Hash] with message key
246
263
  def update_domain_web_prefix(domain, options = {})
264
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
247
265
  fail(ParameterError, 'No domain given to update tracking settings on Mailgun', caller) unless domain
248
266
  @client.put("domains/#{domain}/web_prefix", options).to_h
249
267
  end
@@ -323,6 +341,7 @@ module Mailgun
323
341
  #
324
342
  # Returns [Array] A list of domains (hash)
325
343
  def get_domain_stats(domain, options = {})
344
+ warn('WARN: Client api version must be v3') unless @client.api_version == 'v3'
326
345
  fail(ParameterError, 'No domain given to list stats on Mailgun', caller) unless domain
327
346
  @client.get("#{domain}/stats/total", options).to_h
328
347
  end
@@ -1,4 +1,4 @@
1
1
  # It's the version. Yeay!
2
2
  module Mailgun
3
- VERSION = '1.3.1'
3
+ VERSION = '1.3.2'
4
4
  end
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
  require 'mailgun'
3
3
 
4
- vcr_opts = { :cassette_name => "routes" }
4
+ vcr_opts = { :cassette_name => "routes", :match_requests_on => [:uri, :method, :body] }
5
5
 
6
6
  describe 'For the Routes endpoint', order: :defined, vcr: vcr_opts do
7
7
  before(:all) do
@@ -25,6 +25,22 @@ describe 'For the Routes endpoint', order: :defined, vcr: vcr_opts do
25
25
  expect(result.body["route"]["priority"]).to eq(10)
26
26
  end
27
27
 
28
+ it 'creates a route with multiple actions' do
29
+ result = @mg_obj.post("routes", { priority: 10,
30
+ description: 'Integration Test Route',
31
+ expression: "match_recipient(\"#{@forward_to}\")",
32
+ action: ["forward(\"#{@recipient}\")", "stop()"] })
33
+
34
+ result.to_h!
35
+ expect(result.body["message"]).to eq("Route has been created")
36
+ expect(result.body["route"]["description"]).to eq("Integration Test Route")
37
+ expect(result.body["route"]["actions"].count).to eq 2
38
+ expect(result.body["route"]["actions"][0]).to include("forward(\"#{@recipient}\")")
39
+ expect(result.body["route"]["actions"][1]).to include("stop()")
40
+ expect(result.body["route"]["expression"]).to include("match_recipient(\"#{@forward_to}\")")
41
+ expect(result.body["route"]["priority"]).to eq(10)
42
+ end
43
+
28
44
  it 'gets a list of all routes.' do
29
45
  result = @mg_obj.get("routes", {:limit => 50})
30
46
 
@@ -2,375 +2,69 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api:<APIKEY>@api.mailgun.net/v3/routes
6
- body:
7
- encoding: US-ASCII
8
- string: priority=10&description=Integration%20Test%20Route&expression=match_recipient(%22alice%40DOMAIN.TEST%22)&action=forward(%22.*%40DOMAIN.TEST%22)
9
- headers:
10
- Accept:
11
- - "*/*; q=0.5, application/xml"
12
- Accept-Encoding:
13
- - gzip, deflate
14
- Content-Length:
15
- - '213'
16
- Content-Type:
17
- - application/x-www-form-urlencoded
18
- User-Agent:
19
- - Ruby
20
- response:
21
- status:
22
- code: 200
23
- message: OK
24
- headers:
25
- Server:
26
- - nginx
27
- Date:
28
- - Fri, 08 Jan 2016 20:08:18 GMT
29
- Content-Type:
30
- - application/json
31
- Content-Length:
32
- - '402'
33
- Connection:
34
- - keep-alive
35
- Content-Disposition:
36
- - inline
37
- Access-Control-Allow-Origin:
38
- - "*"
39
- Access-Control-Max-Age:
40
- - '600'
41
- Access-Control-Allow-Methods:
42
- - GET, POST, PUT, DELETE, OPTIONS
43
- Access-Control-Allow-Headers:
44
- - Content-Type, x-requested-with
5
+ uri: https://api.mailgun.net/v3/routes
45
6
  body:
46
7
  encoding: UTF-8
47
- string: |-
48
- {
49
- "message": "Route has been created",
50
- "route": {
51
- "actions": [
52
- "forward(\".*@DOMAIN.TEST\")"
53
- ],
54
- "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
55
- "description": "Integration Test Route",
56
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
57
- "id": "5690173212573000be30671e",
58
- "priority": 10
59
- }
60
- }
61
- http_version:
62
- recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
63
- - request:
64
- method: get
65
- uri: https://api:<APIKEY>@api.mailgun.net/v3/routes?limit=50
66
- body:
67
- encoding: US-ASCII
68
- string: ''
8
+ string: action=forward%28%22.%2A%40%22%29&description=Integration+Test+Route&expression=match_recipient%28%22alice%40%22%29&priority=10
69
9
  headers:
70
- Accept:
71
- - "*/*"
72
- Accept-Encoding:
73
- - gzip, deflate
74
10
  User-Agent:
75
- - Ruby
76
- response:
77
- status:
78
- code: 200
79
- message: OK
80
- headers:
81
- Server:
82
- - nginx
83
- Date:
84
- - Fri, 08 Jan 2016 20:08:18 GMT
85
- Content-Type:
86
- - application/json
87
- Content-Length:
88
- - '1155'
89
- Connection:
90
- - keep-alive
91
- Content-Disposition:
92
- - inline
93
- Access-Control-Allow-Origin:
94
- - "*"
95
- Access-Control-Max-Age:
96
- - '600'
97
- Access-Control-Allow-Methods:
98
- - GET, POST, PUT, DELETE, OPTIONS
99
- Access-Control-Allow-Headers:
100
- - Content-Type, x-requested-with
101
- body:
102
- encoding: UTF-8
103
- string: |-
104
- {
105
- "items": [
106
- {
107
- "actions": [
108
- "forward(\".*@DOMAIN.TEST\")"
109
- ],
110
- "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
111
- "description": "Integration Test Route",
112
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
113
- "id": "5690173212573000be30671e",
114
- "priority": 10
115
- },
116
- {
117
- "actions": [
118
- "forward(\".*@DOMAIN.TEST\")"
119
- ],
120
- "created_at": "Fri, 08 Jan 2016 19:55:02 GMT",
121
- "description": "Integration Test Route",
122
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
123
- "id": "5690141612573000b69c0e35",
124
- "priority": 10
125
- },
126
- {
127
- "actions": [
128
- "forward(\".*@DOMAIN.TEST\")"
129
- ],
130
- "created_at": "Fri, 08 Jan 2016 19:53:50 GMT",
131
- "description": "Integration Test Route",
132
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
133
- "id": "569013ce11e2bdcea3fbcd1d",
134
- "priority": 10
135
- }
136
- ],
137
- "total_count": 3
138
- }
139
- http_version:
140
- recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
141
- - request:
142
- method: get
143
- uri: https://api:<APIKEY>@api.mailgun.net/v3/routes?limit=1
144
- body:
145
- encoding: US-ASCII
146
- string: ''
147
- headers:
11
+ - mailgun-sdk-ruby/1.3.2
148
12
  Accept:
149
13
  - "*/*"
14
+ Authorization:
15
+ - Basic xxx==
16
+ Content-Type:
17
+ - application/x-www-form-urlencoded
150
18
  Accept-Encoding:
151
- - gzip, deflate
152
- User-Agent:
153
- - Ruby
19
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
154
20
  response:
155
21
  status:
156
22
  code: 200
157
23
  message: OK
158
24
  headers:
159
- Server:
160
- - nginx
161
- Date:
162
- - Fri, 08 Jan 2016 20:08:19 GMT
163
- Content-Type:
164
- - application/json
165
- Content-Length:
166
- - '411'
167
- Connection:
168
- - keep-alive
169
- Content-Disposition:
170
- - inline
25
+ Access-Control-Allow-Credentials:
26
+ - 'true'
171
27
  Access-Control-Allow-Origin:
172
28
  - "*"
173
- Access-Control-Max-Age:
174
- - '600'
175
- Access-Control-Allow-Methods:
176
- - GET, POST, PUT, DELETE, OPTIONS
177
- Access-Control-Allow-Headers:
178
- - Content-Type, x-requested-with
179
- body:
180
- encoding: UTF-8
181
- string: |-
182
- {
183
- "items": [
184
- {
185
- "actions": [
186
- "forward(\".*@DOMAIN.TEST\")"
187
- ],
188
- "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
189
- "description": "Integration Test Route",
190
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
191
- "id": "5690173212573000be30671e",
192
- "priority": 10
193
- }
194
- ],
195
- "total_count": 3
196
- }
197
- http_version:
198
- recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
199
- - request:
200
- method: get
201
- uri: https://api:<APIKEY>@api.mailgun.net/v3/routes/5690173212573000be30671e
202
- body:
203
- encoding: US-ASCII
204
- string: ''
205
- headers:
206
- Accept:
207
- - "*/*"
208
- Accept-Encoding:
209
- - gzip, deflate
210
- User-Agent:
211
- - Ruby
212
- response:
213
- status:
214
- code: 200
215
- message: OK
216
- headers:
217
- Server:
218
- - nginx
219
- Date:
220
- - Fri, 08 Jan 2016 20:08:19 GMT
221
- Content-Type:
222
- - application/json
223
- Content-Length:
224
- - '363'
225
- Connection:
226
- - keep-alive
29
+ Cache-Control:
30
+ - no-store
227
31
  Content-Disposition:
228
32
  - inline
229
- Access-Control-Allow-Origin:
230
- - "*"
231
- Access-Control-Max-Age:
232
- - '600'
233
- Access-Control-Allow-Methods:
234
- - GET, POST, PUT, DELETE, OPTIONS
235
- Access-Control-Allow-Headers:
236
- - Content-Type, x-requested-with
237
- body:
238
- encoding: UTF-8
239
- string: |-
240
- {
241
- "route": {
242
- "actions": [
243
- "forward(\".*@DOMAIN.TEST\")"
244
- ],
245
- "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
246
- "description": "Integration Test Route",
247
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
248
- "id": "5690173212573000be30671e",
249
- "priority": 10
250
- }
251
- }
252
- http_version:
253
- recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
254
- - request:
255
- method: put
256
- uri: https://api:<APIKEY>@api.mailgun.net/v3/routes/5690173212573000be30671e
257
- body:
258
- encoding: US-ASCII
259
- string: priority=10&description=Integration%20Test%20Route%20Update&expression=match_recipient(%22alice%40DOMAIN.TEST%22)&action=forward(%22.*%40DOMAIN.TEST%22)
260
- headers:
261
- Accept:
262
- - "*/*; q=0.5, application/xml"
263
- Accept-Encoding:
264
- - gzip, deflate
265
33
  Content-Length:
266
- - '222'
267
- Content-Type:
268
- - application/x-www-form-urlencoded
269
- User-Agent:
270
- - Ruby
271
- response:
272
- status:
273
- code: 200
274
- message: OK
275
- headers:
276
- Server:
277
- - nginx
278
- Date:
279
- - Fri, 08 Jan 2016 20:08:19 GMT
34
+ - '251'
280
35
  Content-Type:
281
36
  - application/json
282
- Content-Length:
283
- - '376'
284
- Connection:
285
- - keep-alive
286
- Content-Disposition:
287
- - inline
288
- Access-Control-Allow-Origin:
289
- - "*"
290
- Access-Control-Max-Age:
291
- - '600'
292
- Access-Control-Allow-Methods:
293
- - GET, POST, PUT, DELETE, OPTIONS
294
- Access-Control-Allow-Headers:
295
- - Content-Type, x-requested-with
37
+ Date:
38
+ - Mon, 27 Jan 2025 17:45:19 GMT
39
+ Server:
40
+ - TwistedWeb/22.10.0
41
+ Strict-Transport-Security:
42
+ - max-age=63072000; includeSubDomains
43
+ X-Mailgun-Key-Id:
44
+ - c02fd0ba-d8dbad66
45
+ X-Xss-Protection:
46
+ - 1; mode=block
296
47
  body:
297
48
  encoding: UTF-8
298
- string: |-
299
- {
300
- "actions": [
301
- "forward(\".*@DOMAIN.TEST\")"
302
- ],
303
- "created_at": "Fri, 08 Jan 2016 20:08:18 GMT",
304
- "description": "Integration Test Route Update",
305
- "expression": "match_recipient(\"alice@DOMAIN.TEST\")",
306
- "id": "5690173212573000be30671e",
307
- "message": "Route has been updated",
308
- "priority": 10
309
- }
49
+ string: '{"message":"Route has been created","route":{"actions":["forward(\".*@\")"],"created_at":"Mon,
50
+ 27 Jan 2025 17:45:19 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@\")","id":"6797c62f6ee0a9fcb1ec5eee","priority":10}}
51
+
52
+ '
310
53
  http_version:
311
- recorded_at: Fri, 08 Jan 2016 20:08:19 GMT
54
+ recorded_at: Mon, 27 Jan 2025 17:45:19 GMT
312
55
  - request:
313
- method: delete
314
- uri: https://api:<APIKEY>@api.mailgun.net/v3/routes/5690173212573000be30671e
56
+ method: get
57
+ uri: https://api.mailgun.net/v3/routes?limit=50
315
58
  body:
316
59
  encoding: US-ASCII
317
60
  string: ''
318
61
  headers:
319
- Accept:
320
- - "*/*; q=0.5, application/xml"
321
- Accept-Encoding:
322
- - gzip, deflate
323
62
  User-Agent:
324
- - Ruby
325
- response:
326
- status:
327
- code: 200
328
- message: OK
329
- headers:
330
- Server:
331
- - nginx
332
- Date:
333
- - Fri, 08 Jan 2016 20:08:19 GMT
334
- Content-Type:
335
- - application/json
336
- Content-Length:
337
- - '77'
338
- Connection:
339
- - keep-alive
340
- Content-Disposition:
341
- - inline
342
- Access-Control-Allow-Origin:
343
- - "*"
344
- Access-Control-Max-Age:
345
- - '600'
346
- Access-Control-Allow-Methods:
347
- - GET, POST, PUT, DELETE, OPTIONS
348
- Access-Control-Allow-Headers:
349
- - Content-Type, x-requested-with
350
- body:
351
- encoding: UTF-8
352
- string: |-
353
- {
354
- "id": "5690173212573000be30671e",
355
- "message": "Route has been deleted"
356
- }
357
- http_version:
358
- recorded_at: Fri, 08 Jan 2016 20:08:20 GMT
359
- - request:
360
- method: post
361
- uri: https://api.mailgun.net/v3/routes
362
- body:
363
- encoding: UTF-8
364
- string: action=forward%28%22.%2A%40DOMAIN.TEST%22%29&description=Integration+Test+Route&expression=match_recipient%28%22alice%40DOMAIN.TEST%22%29&priority=10
365
- headers:
366
- User-Agent:
367
- - mailgun-sdk-ruby/1.3.0
63
+ - mailgun-sdk-ruby/1.3.2
368
64
  Accept:
369
65
  - "*/*"
370
66
  Authorization:
371
67
  - Basic xxx==
372
- Content-Type:
373
- - application/x-www-form-urlencoded
374
68
  Accept-Encoding:
375
69
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
376
70
  response:
@@ -387,36 +81,36 @@ http_interactions:
387
81
  Content-Disposition:
388
82
  - inline
389
83
  Content-Length:
390
- - '353'
84
+ - '234'
391
85
  Content-Type:
392
86
  - application/json
393
87
  Date:
394
- - Sun, 26 Jan 2025 07:29:31 GMT
88
+ - Mon, 27 Jan 2025 17:45:20 GMT
395
89
  Server:
396
90
  - TwistedWeb/22.10.0
397
91
  Strict-Transport-Security:
398
92
  - max-age=63072000; includeSubDomains
399
93
  X-Mailgun-Key-Id:
400
- - 90b59dea-f2d12a53
94
+ - c02fd0ba-d8dbad66
401
95
  X-Xss-Protection:
402
96
  - 1; mode=block
403
97
  body:
404
98
  encoding: UTF-8
405
- string: '{"message":"Route has been created","route":{"actions":["forward(\".*@DOMAIN.TEST\")"],"created_at":"Sun,
406
- 26 Jan 2025 07:29:31 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@DOMAIN.TEST\")","id":"6795e45ba0be5b9e2e38da98","priority":10}}
99
+ string: '{"items":[{"actions":["forward(\".*@\")"],"created_at":"Mon, 27 Jan
100
+ 2025 17:45:19 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@\")","id":"6797c62f6ee0a9fcb1ec5eee","priority":10}],"total_count":1}
407
101
 
408
102
  '
409
103
  http_version:
410
- recorded_at: Sun, 26 Jan 2025 07:29:31 GMT
104
+ recorded_at: Mon, 27 Jan 2025 17:45:20 GMT
411
105
  - request:
412
106
  method: get
413
- uri: https://api.mailgun.net/v3/routes?limit=50
107
+ uri: https://api.mailgun.net/v3/routes?limit=1
414
108
  body:
415
109
  encoding: US-ASCII
416
110
  string: ''
417
111
  headers:
418
112
  User-Agent:
419
- - mailgun-sdk-ruby/1.3.0
113
+ - mailgun-sdk-ruby/1.3.2
420
114
  Accept:
421
115
  - "*/*"
422
116
  Authorization:
@@ -437,40 +131,36 @@ http_interactions:
437
131
  Content-Disposition:
438
132
  - inline
439
133
  Content-Length:
440
- - '1398'
134
+ - '234'
441
135
  Content-Type:
442
136
  - application/json
443
137
  Date:
444
- - Sun, 26 Jan 2025 07:29:32 GMT
138
+ - Mon, 27 Jan 2025 17:45:20 GMT
445
139
  Server:
446
140
  - TwistedWeb/22.10.0
447
141
  Strict-Transport-Security:
448
142
  - max-age=63072000; includeSubDomains
449
143
  X-Mailgun-Key-Id:
450
- - 90b59dea-f2d12a53
144
+ - c02fd0ba-d8dbad66
451
145
  X-Xss-Protection:
452
146
  - 1; mode=block
453
147
  body:
454
148
  encoding: UTF-8
455
- string: '{"items":[{"actions":[],"created_at":"Mon, 24 Jul 2023 11:28:49 GMT","description":"Sample
456
- route","expression":"match_recipient(''.*@sandbox8a33e7ac5fb74b4186ba64b030e88904.mailgun.org'')","id":"64be607123bfc82c0c79c6b5","priority":0},{"actions":[],"created_at":"Mon,
457
- 24 Jul 2023 11:28:21 GMT","description":"Sample route","expression":"match_recipient(''.*@sandbox8a33e7ac5fb74b4186ba64b030e88904.mailgun.org'')","id":"64be60550916aca1ab9b554a","priority":0},{"actions":["forward(\".*@DOMAIN.TEST\")"],"created_at":"Sun,
458
- 26 Jan 2025 07:29:31 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@DOMAIN.TEST\")","id":"6795e45ba0be5b9e2e38da98","priority":10},{"actions":["forward(\".*@DOMAIN.TEST\")"],"created_at":"Sun,
459
- 26 Jan 2025 07:21:17 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@DOMAIN.TEST\")","id":"6795e26d5dddff0a1558835c","priority":10},{"actions":["forward(\".*@DOMAIN.TEST\")"],"created_at":"Sun,
460
- 26 Jan 2025 07:16:55 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@DOMAIN.TEST\")","id":"6795e167182d2aff87d9263c","priority":10}],"total_count":5}
149
+ string: '{"items":[{"actions":["forward(\".*@\")"],"created_at":"Mon, 27 Jan
150
+ 2025 17:45:19 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@\")","id":"6797c62f6ee0a9fcb1ec5eee","priority":10}],"total_count":1}
461
151
 
462
152
  '
463
153
  http_version:
464
- recorded_at: Sun, 26 Jan 2025 07:29:32 GMT
154
+ recorded_at: Mon, 27 Jan 2025 17:45:20 GMT
465
155
  - request:
466
156
  method: get
467
- uri: https://api.mailgun.net/v3/routes?limit=1
157
+ uri: https://api.mailgun.net/v3/routes/6797c62f6ee0a9fcb1ec5eee
468
158
  body:
469
159
  encoding: US-ASCII
470
160
  string: ''
471
161
  headers:
472
162
  User-Agent:
473
- - mailgun-sdk-ruby/1.3.0
163
+ - mailgun-sdk-ruby/1.3.2
474
164
  Accept:
475
165
  - "*/*"
476
166
  Authorization:
@@ -491,40 +181,42 @@ http_interactions:
491
181
  Content-Disposition:
492
182
  - inline
493
183
  Content-Length:
494
- - '251'
184
+ - '216'
495
185
  Content-Type:
496
186
  - application/json
497
187
  Date:
498
- - Sun, 26 Jan 2025 07:29:33 GMT
188
+ - Mon, 27 Jan 2025 17:45:21 GMT
499
189
  Server:
500
190
  - TwistedWeb/22.10.0
501
191
  Strict-Transport-Security:
502
192
  - max-age=63072000; includeSubDomains
503
193
  X-Mailgun-Key-Id:
504
- - 90b59dea-f2d12a53
194
+ - c02fd0ba-d8dbad66
505
195
  X-Xss-Protection:
506
196
  - 1; mode=block
507
197
  body:
508
198
  encoding: UTF-8
509
- string: '{"items":[{"actions":[],"created_at":"Mon, 24 Jul 2023 11:28:49 GMT","description":"Sample
510
- route","expression":"match_recipient(''.*@sandbox8a33e7ac5fb74b4186ba64b030e88904.mailgun.org'')","id":"64be607123bfc82c0c79c6b5","priority":0}],"total_count":5}
199
+ string: '{"route":{"actions":["forward(\".*@\")"],"created_at":"Mon, 27 Jan
200
+ 2025 17:45:19 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@\")","id":"6797c62f6ee0a9fcb1ec5eee","priority":10}}
511
201
 
512
202
  '
513
203
  http_version:
514
- recorded_at: Sun, 26 Jan 2025 07:29:33 GMT
204
+ recorded_at: Mon, 27 Jan 2025 17:45:21 GMT
515
205
  - request:
516
- method: get
517
- uri: https://api.mailgun.net/v3/routes/64be607123bfc82c0c79c6b5
206
+ method: put
207
+ uri: https://api.mailgun.net/v3/routes/6797c62f6ee0a9fcb1ec5eee
518
208
  body:
519
- encoding: US-ASCII
520
- string: ''
209
+ encoding: UTF-8
210
+ string: action=forward%28%22.%2A%40%22%29&description=Integration+Test+Route+Update&expression=match_recipient%28%22alice%40%22%29&priority=10
521
211
  headers:
522
212
  User-Agent:
523
- - mailgun-sdk-ruby/1.3.0
213
+ - mailgun-sdk-ruby/1.3.2
524
214
  Accept:
525
215
  - "*/*"
526
216
  Authorization:
527
217
  - Basic xxx==
218
+ Content-Type:
219
+ - application/x-www-form-urlencoded
528
220
  Accept-Encoding:
529
221
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
530
222
  response:
@@ -541,42 +233,41 @@ http_interactions:
541
233
  Content-Disposition:
542
234
  - inline
543
235
  Content-Length:
544
- - '233'
236
+ - '248'
545
237
  Content-Type:
546
238
  - application/json
547
239
  Date:
548
- - Sun, 26 Jan 2025 07:29:34 GMT
240
+ - Mon, 27 Jan 2025 17:45:22 GMT
549
241
  Server:
550
242
  - TwistedWeb/22.10.0
551
243
  Strict-Transport-Security:
552
244
  - max-age=63072000; includeSubDomains
553
245
  X-Mailgun-Key-Id:
554
- - 90b59dea-f2d12a53
246
+ - c02fd0ba-d8dbad66
555
247
  X-Xss-Protection:
556
248
  - 1; mode=block
557
249
  body:
558
250
  encoding: UTF-8
559
- string: '{"route":{"actions":[],"created_at":"Mon, 24 Jul 2023 11:28:49 GMT","description":"Sample
560
- route","expression":"match_recipient(''.*@sandbox8a33e7ac5fb74b4186ba64b030e88904.mailgun.org'')","id":"64be607123bfc82c0c79c6b5","priority":0}}
251
+ string: '{"actions":["forward(\".*@\")"],"created_at":"Mon, 27 Jan 2025 17:45:19
252
+ GMT","description":"Integration Test Route Update","expression":"match_recipient(\"alice@\")","id":"6797c62f6ee0a9fcb1ec5eee","message":"Route
253
+ has been updated","priority":10}
561
254
 
562
255
  '
563
256
  http_version:
564
- recorded_at: Sun, 26 Jan 2025 07:29:34 GMT
257
+ recorded_at: Mon, 27 Jan 2025 17:45:22 GMT
565
258
  - request:
566
- method: put
567
- uri: https://api.mailgun.net/v3/routes/64be607123bfc82c0c79c6b5
259
+ method: delete
260
+ uri: https://api.mailgun.net/v3/routes/6797c62f6ee0a9fcb1ec5eee
568
261
  body:
569
- encoding: UTF-8
570
- string: action=forward%28%22.%2A%40DOMAIN.TEST%22%29&description=Integration+Test+Route+Update&expression=match_recipient%28%22alice%40DOMAIN.TEST%22%29&priority=10
262
+ encoding: US-ASCII
263
+ string: ''
571
264
  headers:
572
265
  User-Agent:
573
- - mailgun-sdk-ruby/1.3.0
266
+ - mailgun-sdk-ruby/1.3.2
574
267
  Accept:
575
268
  - "*/*"
576
269
  Authorization:
577
270
  - Basic xxx==
578
- Content-Type:
579
- - application/x-www-form-urlencoded
580
271
  Accept-Encoding:
581
272
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
582
273
  response:
@@ -593,41 +284,41 @@ http_interactions:
593
284
  Content-Disposition:
594
285
  - inline
595
286
  Content-Length:
596
- - '350'
287
+ - '69'
597
288
  Content-Type:
598
289
  - application/json
599
290
  Date:
600
- - Sun, 26 Jan 2025 07:29:34 GMT
291
+ - Mon, 27 Jan 2025 17:45:22 GMT
601
292
  Server:
602
293
  - TwistedWeb/22.10.0
603
294
  Strict-Transport-Security:
604
295
  - max-age=63072000; includeSubDomains
605
296
  X-Mailgun-Key-Id:
606
- - 90b59dea-f2d12a53
297
+ - c02fd0ba-d8dbad66
607
298
  X-Xss-Protection:
608
299
  - 1; mode=block
609
300
  body:
610
301
  encoding: UTF-8
611
- string: '{"actions":["forward(\".*@DOMAIN.TEST\")"],"created_at":"Mon, 24 Jul
612
- 2023 11:28:49 GMT","description":"Integration Test Route Update","expression":"match_recipient(\"alice@DOMAIN.TEST\")","id":"64be607123bfc82c0c79c6b5","message":"Route
613
- has been updated","priority":10}
302
+ string: '{"id":"6797c62f6ee0a9fcb1ec5eee","message":"Route has been deleted"}
614
303
 
615
304
  '
616
305
  http_version:
617
- recorded_at: Sun, 26 Jan 2025 07:29:35 GMT
306
+ recorded_at: Mon, 27 Jan 2025 17:45:23 GMT
618
307
  - request:
619
- method: delete
620
- uri: https://api.mailgun.net/v3/routes/64be607123bfc82c0c79c6b5
308
+ method: post
309
+ uri: https://api.mailgun.net/v3/routes
621
310
  body:
622
- encoding: US-ASCII
623
- string: ''
311
+ encoding: UTF-8
312
+ string: action=forward%28%22.%2A%40%22%29&action=stop%28%29&description=Integration+Test+Route&expression=match_recipient%28%22alice%40%22%29&priority=10
624
313
  headers:
625
314
  User-Agent:
626
- - mailgun-sdk-ruby/1.3.0
315
+ - mailgun-sdk-ruby/1.3.2
627
316
  Accept:
628
317
  - "*/*"
629
318
  Authorization:
630
319
  - Basic xxx==
320
+ Content-Type:
321
+ - application/x-www-form-urlencoded
631
322
  Accept-Encoding:
632
323
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
633
324
  response:
@@ -644,24 +335,25 @@ http_interactions:
644
335
  Content-Disposition:
645
336
  - inline
646
337
  Content-Length:
647
- - '69'
338
+ - '260'
648
339
  Content-Type:
649
340
  - application/json
650
341
  Date:
651
- - Sun, 26 Jan 2025 07:29:35 GMT
342
+ - Mon, 27 Jan 2025 18:13:42 GMT
652
343
  Server:
653
344
  - TwistedWeb/22.10.0
654
345
  Strict-Transport-Security:
655
346
  - max-age=63072000; includeSubDomains
656
347
  X-Mailgun-Key-Id:
657
- - 90b59dea-f2d12a53
348
+ - c02fd0ba-d8dbad66
658
349
  X-Xss-Protection:
659
350
  - 1; mode=block
660
351
  body:
661
352
  encoding: UTF-8
662
- string: '{"id":"64be607123bfc82c0c79c6b5","message":"Route has been deleted"}
353
+ string: '{"message":"Route has been created","route":{"actions":["forward(\".*@\")","stop()"],"created_at":"Mon,
354
+ 27 Jan 2025 18:13:42 GMT","description":"Integration Test Route","expression":"match_recipient(\"alice@\")","id":"6797ccd69440716211d9df05","priority":10}}
663
355
 
664
356
  '
665
357
  http_version:
666
- recorded_at: Sun, 26 Jan 2025 07:29:35 GMT
358
+ recorded_at: Mon, 27 Jan 2025 18:13:42 GMT
667
359
  recorded_with: VCR 3.0.3
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailgun-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mailgun
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-01-26 00:00:00.000000000 Z
12
+ date: 2025-01-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: bundler
@@ -171,7 +171,6 @@ files:
171
171
  - docs/EmailValidation.md
172
172
  - docs/Events.md
173
173
  - docs/MessageBuilder.md
174
- - docs/Messages.md
175
174
  - docs/Metrics.md
176
175
  - docs/OptInHandler.md
177
176
  - docs/Snippets.md
@@ -288,7 +287,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
288
287
  - !ruby/object:Gem::Version
289
288
  version: '0'
290
289
  requirements: []
291
- rubygems_version: 3.3.27
290
+ rubygems_version: 3.3.26
292
291
  signing_key:
293
292
  specification_version: 4
294
293
  summary: Mailgun's Official Ruby SDK
data/docs/Messages.md DELETED
@@ -1,107 +0,0 @@
1
- Mailgun - Messages
2
- ====================
3
-
4
- This is the Mailgun Ruby *Message* utilities.
5
-
6
- The below assumes you've already installed the Mailgun Ruby SDK in to your
7
- project. If not, go back to the master README for instructions.
8
-
9
- There are two utilities included, Message Builder and Batch Message.
10
-
11
- Message Builder: Allows you to build a message object by calling methods for
12
- each MIME attribute.
13
- Batch Message: Inherits Message Builder and allows you to iterate through
14
- recipients from a list. Messages will fire after the 1,000th recipient has been
15
- added.
16
-
17
- Usage - Message Builder
18
- -----------------------
19
- Here's how to use Message Builder to build your Message.
20
-
21
- ```ruby
22
- # First, instantiate the Mailgun Client with your API key
23
- mg_client = Mailgun::Client.new("your-api-key")
24
- mb_obj = Mailgun::MessageBuilder.new
25
-
26
- # Define the from address.
27
- mb_obj.set_from_address("me@example.com", {"first"=>"Ruby", "last" => "SDK"})
28
-
29
- # Define a to recipient.
30
- mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John", "last" => "Doe"})
31
-
32
- # Define a cc recipient.
33
- mb_obj.add_recipient(:cc, "sally.doe@example.com", {"first" => "Sally", "last" => "Doe"})
34
-
35
- # Define the subject.
36
- mb_obj.set_subject("A message from the Ruby SDK using Message Builder!")
37
-
38
- # Define the body of the message.
39
- mb_obj.set_text_body("This is the text body of the message!")
40
-
41
- # Define the HTML text of the message
42
- mb_obj.set_html_body("<html><body><p>This is the text body of the message</p></body></html>")
43
-
44
- # Set the Message-Id header. Pass in a valid Message-Id.
45
- mb_obj.set_message_id("<20141014000000.11111.11111@example.com>")
46
-
47
- # Clear the Message-Id header. Pass in nil or empty string.
48
- mb_obj.set_message_id(nil)
49
- mb_obj.set_message_id('')
50
-
51
- # Other Optional Parameters.
52
- mb_obj.add_campaign_id("My-Awesome-Campaign")
53
- mb_obj.header("Customer-Id", "12345")
54
- mb_obj.add_attachment("./tron.jpg")
55
- mb_obj.set_delivery_time("tomorrow 8:00AM PST")
56
- mb_obj.set_click_tracking(true)
57
-
58
- # Send your message through the client
59
- mg_client.send_message("sending_domain.com", mb_obj)
60
- ```
61
-
62
- Usage - Batch Message
63
- ---------------------
64
- Here's how to use Batch Message to easily handle batch sending jobs.
65
-
66
- ```ruby
67
- # First, instantiate the Mailgun Client with your API key
68
- mg_client = Mailgun::Client.new("your-api-key")
69
- mb_obj = Mailgun::BatchMessage.new(mg_client, "example.com")
70
-
71
- # Define the from address.
72
- mb_obj.set_from_address("me@example.com", {"first"=>"Ruby", "last" => "SDK"})
73
-
74
- # Define the subject.
75
- mb_obj.set_subject("A message from the Ruby SDK using Message Builder!")
76
-
77
- # Define the body of the message.
78
- mb_obj.set_text_body("Hello %recipient.first%,
79
- This is the text body of the message
80
- using recipient variables!
81
- If you need to include custom data,
82
- you could do it like this: %recipient.account-id%.")
83
-
84
- mb_obj.add_recipient(:to, "john.doe@example.com", {"first" => "John",
85
- "last" => "Doe",
86
- "account-id" => 1234})
87
-
88
- mb_obj.add_recipient(:to, "jane.doe@example.com", {"first" => "Jane",
89
- "last" => "Doe",
90
- "account-id" => 5678})
91
-
92
- mb_obj.add_recipient(:to, "bob.doe@example.com", {"first" => "Bob",
93
- "last" => "Doe",
94
- "account-id" => 91011})
95
- ...
96
- mb_obj.add_recipient(:to, "sally.doe@example.com", {"first" => "Sally",
97
- "last" => "Doe",
98
- "account-id" => 121314})
99
-
100
- # Send your message through the client
101
- message_ids = mb_obj.finalize
102
- ```
103
-
104
- More Documentation
105
- ------------------
106
- See the official [Mailgun Docs](https://documentation.mailgun.com/en/latest/api-sending.html)
107
- for more information.