mandrill_mailer 0.3.4 → 0.3.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +17 -5
- data/lib/mandrill_mailer/template_mailer.rb +12 -1
- data/lib/mandrill_mailer/version.rb +1 -1
- data/spec/template_mailer_spec.rb +5 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
ZjU3N2RkOTU1MzJlYWYzYjk0ZDIwYjQ3OGMyODE3OGQ2YjY3ZTM0MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
ZTc2YjBkMjU5MTQ4MmRiZDI2NDE1YzlmNTQ1ZTY4MTUzYTdmOWU0MQ==
|
7
7
|
!binary "U0hBNTEy":
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NTVmZjE0NTBhNzU5NGJiN2YyOGRiM2RkNzRlOWIyOTA2ZTE0MGQzZWMyYzA4
|
10
|
+
ZmMyNWUzYTZhN2ZhNWE4YmZjMGNjOGMyMzQ4ZjM3ZjNhNDM5Y2ZkNjk4ZTRi
|
11
|
+
Nzc2ZGQ3NDllZTEyMGY3MjEwOGZiNmM1Y2IzNTYzNzIyOWIxNjE=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NzYwMTJkZWI2MGUyMzY2ZDdlYjBkM2I4NjA1NzQzOTVkZDYzMmU3NzQwMzhi
|
14
|
+
ZDhkM2ZiOGZmNmY3ZWIwZmI0OTY2YjgyMmNmYmE5NDk4NzU3OGFiNDdkY2Yy
|
15
|
+
ZjExZTE5YThmZjc2ZDJiN2EwYTM1MzkxMzg3MTZhNjdhNWE4OTM=
|
data/README.md
CHANGED
@@ -48,6 +48,8 @@ Creating a new Mandrill Mailer is similar to a normal Rails mailer:
|
|
48
48
|
'OWNER_NAME' => invitation.owner_name,
|
49
49
|
'PROJECT_NAME' => invitation.project_name
|
50
50
|
},
|
51
|
+
important: true,
|
52
|
+
inline_css: true,
|
51
53
|
recipient_vars: invitation.invitees.map do |invitee| # invitation.invitees is an Array ,
|
52
54
|
{ invitee.email =>
|
53
55
|
{
|
@@ -103,6 +105,15 @@ Creating a new Mandrill Mailer is similar to a normal Rails mailer:
|
|
103
105
|
the utm_campaign tracking parameter. If this isn't provided the email's
|
104
106
|
from address will be used instead.
|
105
107
|
|
108
|
+
* `:important` - whether or not this message is important, and should be delivered ahead of non-important messages.
|
109
|
+
|
110
|
+
* `:inline_css` - whether or not to automatically inline all CSS styles provided in the message HTML - only for HTML documents less than 256KB in size.
|
111
|
+
|
112
|
+
* `:attachments` - An array of file objects with the following keys:
|
113
|
+
* `file:` This is the actual file, it will be converted to byte data in the mailer
|
114
|
+
* `filename:` The name of the file
|
115
|
+
* `mimetype:` This is the mimetype of the file. Ex. png = image/png, pdf = application/pdf, txt = text/plain etc
|
116
|
+
|
106
117
|
## Sending an email
|
107
118
|
|
108
119
|
You can send the email by using the familiar syntax:
|
@@ -160,16 +171,17 @@ handle_asynchronously :send_hallpass_expired_mailer
|
|
160
171
|
or using a custom job
|
161
172
|
|
162
173
|
```ruby
|
163
|
-
def update_email_on_newsletter_subscription
|
164
|
-
Delayed::Job.enqueue( UpdateEmailJob.new(user
|
174
|
+
def update_email_on_newsletter_subscription(user)
|
175
|
+
Delayed::Job.enqueue( UpdateEmailJob.new(user_id: user.id) )
|
165
176
|
end
|
166
177
|
```
|
167
|
-
The job looks like:
|
178
|
+
The job looks like (Don't send full objects into jobs, send ids and requery inside the job. This prevents Delayed Job from having to serialize and deserialize whole ActiveRecord Objectsm and you're data is current when the job runs):
|
168
179
|
|
169
180
|
```ruby
|
170
|
-
class UpdateEmailJob < Struct.new(:
|
181
|
+
class UpdateEmailJob < Struct.new(:user_id)
|
171
182
|
def perform
|
172
|
-
|
183
|
+
user = User.find(user_id)
|
184
|
+
HallpassMailer.hallpass_expired(user).deliver
|
173
185
|
end
|
174
186
|
end
|
175
187
|
```
|
@@ -24,7 +24,9 @@
|
|
24
24
|
# }
|
25
25
|
# end,
|
26
26
|
# template_content: {},
|
27
|
-
# attachments: [{file: File.read(File.expand_path('assets/some_image.png')), filename: 'My Image.png', mimetype: 'image/png'}]
|
27
|
+
# attachments: [{file: File.read(File.expand_path('assets/some_image.png')), filename: 'My Image.png', mimetype: 'image/png'}],
|
28
|
+
# important: true,
|
29
|
+
# inline_css: true
|
28
30
|
# end
|
29
31
|
# end
|
30
32
|
|
@@ -74,6 +76,11 @@
|
|
74
76
|
# :google_analytics_campaign - String indicating the value to set for
|
75
77
|
# the utm_campaign tracking parameter. If this isn't provided the email's
|
76
78
|
# from address will be used instead.
|
79
|
+
|
80
|
+
# :inline_css - whether or not to automatically inline all CSS styles provided in the
|
81
|
+
# message HTML - only for HTML documents less than 256KB in size
|
82
|
+
|
83
|
+
# :important - whether or not this message is important, and should be delivered ahead of non-important messages
|
77
84
|
require 'base64'
|
78
85
|
|
79
86
|
module MandrillMailer
|
@@ -189,6 +196,8 @@ module MandrillMailer
|
|
189
196
|
# :tags - Tags for the email
|
190
197
|
# :google_analytics_domains - Google analytics domains
|
191
198
|
# :google_analytics_campaign - Google analytics campaign
|
199
|
+
# :inline_css - whether or not to automatically inline all CSS styles provided in the message HTML
|
200
|
+
# :important - whether or not this message is important
|
192
201
|
#
|
193
202
|
# Examples
|
194
203
|
#
|
@@ -225,9 +234,11 @@ module MandrillMailer
|
|
225
234
|
"from_name" => args[:from_name] || self.class.defaults[:from_name] || self.class.defaults[:from],
|
226
235
|
"to" => args[:to],
|
227
236
|
"headers" => args[:headers],
|
237
|
+
"important" => args[:important],
|
228
238
|
"track_opens" => true,
|
229
239
|
"track_clicks" => true,
|
230
240
|
"auto_text" => true,
|
241
|
+
"inline_css" => args[:inline_css],
|
231
242
|
"url_strip_qs" => true,
|
232
243
|
"preserve_recipients" => args[:preserve_recipients],
|
233
244
|
"bcc_address" => args[:bcc],
|
@@ -148,7 +148,9 @@ describe MandrillMailer::TemplateMailer do
|
|
148
148
|
tags: ['tag1'],
|
149
149
|
google_analytics_domains: ["http://site.com"],
|
150
150
|
google_analytics_campaign: '1237423474',
|
151
|
-
attachments: [{file: attachment_file, filename: attachment_filename, mimetype: attachment_mimetype}]
|
151
|
+
attachments: [{file: attachment_file, filename: attachment_filename, mimetype: attachment_mimetype}],
|
152
|
+
inline_css: true,
|
153
|
+
important: true
|
152
154
|
}
|
153
155
|
end
|
154
156
|
|
@@ -177,6 +179,8 @@ describe MandrillMailer::TemplateMailer do
|
|
177
179
|
"from_name" => from_name,
|
178
180
|
"to" => [{'email' => to_email, 'name' => to_name}],
|
179
181
|
"headers" => args[:headers],
|
182
|
+
"important" => args[:important],
|
183
|
+
"inline_css" => args[:inline_css],
|
180
184
|
"track_opens" => true,
|
181
185
|
"track_clicks" => true,
|
182
186
|
"auto_text" => true,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mandrill_mailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adam Rensel
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|