mailpy 0.1.6 → 0.1.7
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 +4 -4
- data/README.md +13 -1
- data/lib/mailpy.rb +10 -3
- data/lib/mailpy/smtp_api.rb +14 -0
- data/lib/mailpy/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e8a89f05d3dd0d6875dd4721e7fddeb47932ea72bca76b29dba13426867f6caa
|
4
|
+
data.tar.gz: 25c5965f5b4938b48351dd43371cd0341512735cd83f9cd0579ed2f37c0051ae
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8d82d4ab3cdc74541b61357735c6c29f0cb7af8fa70aedfb745a4c4255ff2f935fb28879d9db3c0a4cebcd38dbf1f5d75a50149c1d401ea14ce00688aeeea6e7
|
7
|
+
data.tar.gz: 67b066c8a6d5587c88e50116c889f0bcf616c09673aa1a6ccb1e4fed52a02c30847885fbccf0485754ef0896b8eff5b57d7cc4054398220d9a94230c4ac8eeca
|
data/README.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
# Mailpy
|
2
|
-
Action Mailer Adapter for
|
2
|
+
Action Mailer Adapter for Sending Email Through HTTP APIs. Mailpy will automatically switch to SMTP method in case your mailer server encounter any problem.
|
3
3
|
|
4
4
|
## Usage
|
5
5
|
How to use my plugin.
|
@@ -15,12 +15,24 @@ Add configuration to your application environments. development.rb, staging.rb,
|
|
15
15
|
|
16
16
|
```ruby
|
17
17
|
config.action_mailer.delivery_method = :mailpy
|
18
|
+
config.action_mailer.perform_deliveries = true
|
19
|
+
config.action_mailer.raise_delivery_errors = true
|
18
20
|
config.action_mailer.mailpy_settings = {
|
19
21
|
endpoint: ENV['MAILER_API_ENDPOINT'],
|
20
22
|
headers: {
|
21
23
|
Authorization: ENV['MAILER_API_KEY_OR_AUTH_TOKEN']
|
22
24
|
}
|
23
25
|
}
|
26
|
+
config.action_mailer.smtp_settings = {
|
27
|
+
address: ENV['SMTP_ADDRESS'],
|
28
|
+
port: ENV['SMTP_PORT'],
|
29
|
+
domain: ENV['SMTP_DOMAIN'],
|
30
|
+
authentication: ENV['SMTP_AUTHENTICATION_METHOD'],
|
31
|
+
user_name: ENV['SMTP_USERNAME'],
|
32
|
+
password: ENV['SMTP_PASSWORD'],
|
33
|
+
enable_starttls_auto: true,
|
34
|
+
openssl_verify_mode: 'none'
|
35
|
+
}
|
24
36
|
```
|
25
37
|
|
26
38
|
And then execute:
|
data/lib/mailpy.rb
CHANGED
@@ -17,9 +17,16 @@ module Mailpy
|
|
17
17
|
|
18
18
|
private
|
19
19
|
def perform_send_request(mail, settings)
|
20
|
-
|
21
|
-
|
22
|
-
|
20
|
+
begin
|
21
|
+
result = MailerApi.new(mail, settings).send
|
22
|
+
raise(MailpyDeliveryError, JSON.parse(result.body)['message']) unless result.code === 200
|
23
|
+
result
|
24
|
+
rescue Errno::ECONNREFUSED
|
25
|
+
smtp_settings = Rails.application.config.action_mailer.smtp_settings
|
26
|
+
raise(MailpyDeliveryError, "SMTP miss configured. Please add SMTP configuration in your environment config") if smtp_settings.blank?
|
27
|
+
result = SMTPApi.new(mail, smtp_settings).send
|
28
|
+
result
|
29
|
+
end
|
23
30
|
end
|
24
31
|
end
|
25
32
|
end
|
data/lib/mailpy/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mailpy
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nasrul Gunawan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-04-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -51,6 +51,7 @@ files:
|
|
51
51
|
- lib/mailpy.rb
|
52
52
|
- lib/mailpy/mailer_api.rb
|
53
53
|
- lib/mailpy/railtie.rb
|
54
|
+
- lib/mailpy/smtp_api.rb
|
54
55
|
- lib/mailpy/version.rb
|
55
56
|
homepage: https://github.com/nasrulgunawan/mailpy
|
56
57
|
licenses:
|