mailpace-rails 0.4.0 → 0.4.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 116f3c2d1a6a94ee97b33eccd6b576ffa86146e262fa18fea458fd30cc6ce9bb
4
- data.tar.gz: 367ca296eff427a12a36a56096a04ebc0e694f635d9667c629db4b67c67f65bd
3
+ metadata.gz: 4bddf2babf3726e39c5bcf3d3866bbe97920ae3013864a328e3621f8dd72c3ab
4
+ data.tar.gz: 03f854b13967e2f5e5e31f83935522d734dcfd001cec171ac243f496d5b83355
5
5
  SHA512:
6
- metadata.gz: 2c93b6b5261b781d2692f76732deea6940ab615229cb548986d44023245e5426fdb98937a046cb7dc7f57b5f3c14301107784b22aca641f6c5e10fc1c4ae3467
7
- data.tar.gz: 9a4e461785290e63f2bced09602a6c9770ca747d120ba8ac1247d9fc7a792bf91347f74ef759473604baefdb46cdaf9a9cf56c351ba8e6b4d87b1db97d9c09ce
6
+ metadata.gz: 861485b876d02f2565a938fb397f9737cce872939e162640303f998d15a3ccf986a2a7e49b4e838d283680fbd4df4dfca6588c02ed1c25b9a368ec5bede0fe1c
7
+ data.tar.gz: 06b646a8c7e65121e44e117171d233ff600217d73a16623bb829d8a407dbc59b6c7999f4f8e9cb8aeb48a8abd8cdee1424334870bbf2e28be69ddfbca9792d76
data/README.md CHANGED
@@ -155,6 +155,10 @@ class TestMailer < ApplicationMailer
155
155
  end
156
156
  ```
157
157
 
158
+ ## ActiveStorage Configuration
159
+
160
+ This gem depends on ActiveStorage for handling inbound emails. If you do not have ActiveStorage configured in your Rails App you may need to create an empty file `config/storage.yml` for this Gem to work.
161
+
158
162
  ## Support
159
163
 
160
164
  For support please check the [MailPace Documentation](https://docs.mailpace.com) or contact us at support@mailpace.com
@@ -1,5 +1,5 @@
1
1
  module Mailpace
2
2
  module Rails
3
- VERSION = '0.4.0'
3
+ VERSION = '0.4.2'
4
4
  end
5
5
  end
@@ -17,20 +17,27 @@ module Mailpace
17
17
  end
18
18
 
19
19
  def deliver!(mail)
20
+ if mail.multipart?
21
+ htmlbody = mail.html_part.body.decoded,
22
+ textbody = mail.text_part.body.decoded
23
+ elsif mail.mime_type == "text/plain"
24
+ textbody = mail.body.to_s
25
+ else
26
+ htmlbody = mail.body.to_s
27
+ end
28
+
20
29
  check_delivery_params(mail)
21
30
  result = HTTParty.post(
22
31
  'https://app.mailpace.com/api/v1/send',
23
32
  body: {
24
33
  from: address_list(mail.header[:from])&.addresses&.first.to_s,
25
- to: mail.to.join(','),
34
+ to: address_list(mail.header[:to])&.addresses&.join(','),
26
35
  subject: mail.subject,
27
- htmlbody: mail.html_part ? mail.html_part.body.decoded : mail.body.to_s,
28
- textbody: if mail.multipart?
29
- mail.text_part ? mail.text_part.body.decoded : nil
30
- end,
36
+ htmlbody: htmlbody,
37
+ textbody: textbody,
31
38
  cc: address_list(mail.header[:cc])&.addresses&.join(','),
32
39
  bcc: address_list(mail.header[:bcc])&.addresses&.join(','),
33
- replyto: mail.reply_to&.join(','),
40
+ replyto: address_list(mail.header[:reply_to])&.addresses&.join(','),
34
41
  inreplyto: mail.header['In-Reply-To'].to_s,
35
42
  references: mail.header['References'].to_s,
36
43
  list_unsubscribe: mail.header['list_unsubscribe'].to_s,
@@ -41,9 +48,10 @@ module Mailpace
41
48
  'User-Agent' => "MailPace Rails Gem v#{Mailpace::Rails::VERSION}",
42
49
  'Accept' => 'application/json',
43
50
  'Content-Type' => 'application/json',
44
- 'Mailpace-Server-Token' => settings[:api_token],
45
- 'Idempotency-Key' => mail.header['idempotency_key'].to_s
46
- }
51
+ 'Mailpace-Server-Token' => settings[:api_token]
52
+ }.tap do |h|
53
+ h['Idempotency-Key'] = mail.header['idempotency_key'].to_s if mail.header['idempotency_key']
54
+ end
47
55
  )
48
56
 
49
57
  handle_response(result)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mailpace-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - MailPace
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-10-14 00:00:00.000000000 Z
11
+ date: 2025-06-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: actionmailer
@@ -131,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  - !ruby/object:Gem::Version
132
132
  version: '0'
133
133
  requirements: []
134
- rubygems_version: 3.5.16
134
+ rubygems_version: 3.5.22
135
135
  signing_key:
136
136
  specification_version: 4
137
137
  summary: Lets you send transactional emails from your app over an easy to use API