hertz-courier-email 1.0.3 → 1.1.0
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 -0
- data/app/mailers/hertz/courier/email/notification_mailer.rb +11 -4
- data/lib/hertz/courier/email/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08ef7e4eea8f5d9f83215c0eab906a09eaec33ab'
|
4
|
+
data.tar.gz: af9c7f1a665ad74a9168be2dd541e03132b3b141
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 63494ba427e3dbf010dfa55ce995d7ed7ec52871e7090dbb8d77372cd37d3c1f769ded3fc0eef2e23b771079b8ab2a09ed835c87a293334abf10107b6517b191
|
7
|
+
data.tar.gz: 72915d4010dfba993c5e076884050935e6783bf984171f13c3fb9626ffb1dc5f26d91ac428c298dab298b0aea342c8442ebc3c7123245031decb2ed3f2919ddf
|
data/README.md
CHANGED
@@ -93,6 +93,19 @@ class CommentNotification < Hertz::Notification
|
|
93
93
|
end
|
94
94
|
```
|
95
95
|
|
96
|
+
You may also pass more options to the `#mail` method of the mailer by defining a `#email_options` method:
|
97
|
+
|
98
|
+
```ruby
|
99
|
+
class CommentNotification < Hertz::Notification
|
100
|
+
def email_options
|
101
|
+
{
|
102
|
+
# generate a custom Reply-To address for the receiver
|
103
|
+
reply_to: "replies+#{receiver.id}@example.com"
|
104
|
+
}
|
105
|
+
end
|
106
|
+
end
|
107
|
+
```
|
108
|
+
|
96
109
|
Finally, you should create a template for every notification you send by email.
|
97
110
|
For `CommentNotification` you'd create a template at
|
98
111
|
`app/views/hertz/courier/email/notification_mailer/comment_notification.html.erb`:
|
@@ -5,15 +5,22 @@ module Hertz
|
|
5
5
|
class NotificationMailer < Hertz::Courier::Email.base_mailer
|
6
6
|
def notification_email(notification)
|
7
7
|
@notification = notification
|
8
|
+
mail email_options_for(notification)
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
8
12
|
|
9
|
-
|
13
|
+
def email_options_for(notification)
|
14
|
+
options = {
|
10
15
|
to: notification.receiver.hertz_email,
|
11
16
|
subject: notification.email_subject,
|
12
17
|
template_name: view_for(notification)
|
13
|
-
|
14
|
-
end
|
18
|
+
}
|
15
19
|
|
16
|
-
|
20
|
+
options = options.merge(notification.email_options) if notification.respond_to?(:email_options)
|
21
|
+
|
22
|
+
options
|
23
|
+
end
|
17
24
|
|
18
25
|
def view_for(notification)
|
19
26
|
if notification.respond_to?(:email_template)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hertz-courier-email
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Desantis
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-03-
|
11
|
+
date: 2017-03-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|