actionmailer 4.2.0.beta4 → 4.2.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of actionmailer might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/CHANGELOG.md +30 -17
- data/README.rdoc +21 -11
- data/lib/action_mailer/base.rb +17 -11
- data/lib/action_mailer/gem_version.rb +1 -1
- data/lib/rails/generators/mailer/mailer_generator.rb +1 -0
- data/lib/rails/generators/mailer/templates/application_mailer.rb +4 -0
- data/lib/rails/generators/mailer/templates/mailer.rb +1 -2
- metadata +22 -21
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 800efd649ee1a4c76b8156c66c3889abbecc3b02
|
4
|
+
data.tar.gz: cbd8ac503116232af6cbac98bc84ecf6700dfcf8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be504a159dc18d224143486b07d77cfd4fdcc7847baaa1e6226fa84e02872c2fcb92cc9d5e67ed6b6114be0fcb21320e02f0772843fbe12251111879ce665d23
|
7
|
+
data.tar.gz: 18e6caed1d21195448f0932672367b560b4fe74ba52b081f3c95ea0b29e1e6541a76fc11c8f7050ab8d41aa047158b68c4804b48f6db2e1e2f17b9a944450d0d
|
data/CHANGELOG.md
CHANGED
@@ -1,30 +1,42 @@
|
|
1
|
-
*
|
1
|
+
* `MailerGenerator` now generates layouts by default. The HTML mailer layout
|
2
|
+
now includes `<html>` and `<body>` tags which improve the spam rating in
|
3
|
+
some spam detection engines. Mailers now inherit from `ApplicationMailer`
|
4
|
+
which sets the default layout.
|
5
|
+
|
6
|
+
*Andy Jeffries*
|
7
|
+
|
8
|
+
* `link_to` and `url_for` now generate URLs by default in templates.
|
9
|
+
Passing `only_path: false` is no longer needed.
|
10
|
+
|
11
|
+
Fixes #16497 and #16589.
|
12
|
+
|
13
|
+
*Xavier Noria*, *Richard Schneeman*
|
14
|
+
|
15
|
+
* Attachments can now be added while rendering the mail template.
|
2
16
|
|
3
17
|
Fixes #16974.
|
4
18
|
|
5
19
|
*Christian Felder*
|
6
20
|
|
7
|
-
*
|
8
|
-
`#deliver_now`. `#deliver_later` will enqueue a job to render and
|
9
|
-
the mail instead of delivering it
|
10
|
-
using the new Active Job framework in Rails
|
11
|
-
configured
|
21
|
+
* Add `#deliver_later` and `#deliver_now` methods and deprecate `#deliver` in
|
22
|
+
favor of `#deliver_now`. `#deliver_later` will enqueue a job to render and
|
23
|
+
deliver the mail instead of delivering it immediately. The job is enqueued
|
24
|
+
using the new Active Job framework in Rails and will use the queue that you
|
25
|
+
have configured in Rails.
|
12
26
|
|
13
27
|
*DHH*, *Abdelkader Boudih*, *Cristian Bica*
|
14
28
|
|
15
|
-
*
|
16
|
-
instance methods and `ActionMailer` tries to render a message when they
|
17
|
-
are called.
|
29
|
+
* `ActionMailer::Previews` are now class methods instead of instance methods.
|
18
30
|
|
19
31
|
*Cristian Bica*
|
20
32
|
|
21
|
-
* Deprecate `*_path` helpers in email views.
|
22
|
-
|
23
|
-
|
33
|
+
* Deprecate `*_path` helpers in email views. They generated broken links in
|
34
|
+
email views and were not the intention of most developers. The `*_url`
|
35
|
+
helper is recommended instead.
|
24
36
|
|
25
37
|
*Richard Schneeman*
|
26
38
|
|
27
|
-
* Raise an exception when attachments are added after `mail`
|
39
|
+
* Raise an exception when attachments are added after `mail` is called.
|
28
40
|
This is a safeguard to prevent invalid emails.
|
29
41
|
|
30
42
|
Fixes #16163.
|
@@ -33,10 +45,10 @@
|
|
33
45
|
|
34
46
|
* Add `config.action_mailer.show_previews` configuration option.
|
35
47
|
|
36
|
-
This
|
37
|
-
other than development (such as staging).
|
48
|
+
This configuration option can be used to enable the mail preview in
|
49
|
+
environments other than development (such as staging).
|
38
50
|
|
39
|
-
Defaults to `true` in development and false elsewhere.
|
51
|
+
Defaults to `true` in development and `false` elsewhere.
|
40
52
|
|
41
53
|
*Leonard Garvey*
|
42
54
|
|
@@ -47,4 +59,5 @@
|
|
47
59
|
|
48
60
|
*Yves Senn*
|
49
61
|
|
50
|
-
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionmailer/CHANGELOG.md)
|
62
|
+
Please check [4-1-stable](https://github.com/rails/rails/blob/4-1-stable/actionmailer/CHANGELOG.md)
|
63
|
+
for previous changes.
|
data/README.rdoc
CHANGED
@@ -61,7 +61,7 @@ generated would look like this:
|
|
61
61
|
|
62
62
|
Thank you for signing up!
|
63
63
|
|
64
|
-
In order to send mails, you simply call the method and then call +
|
64
|
+
In order to send mails, you simply call the method and then call +deliver_now+ on the return value.
|
65
65
|
|
66
66
|
Calling the method returns a Mail Message object:
|
67
67
|
|
@@ -74,9 +74,17 @@ Or you can just chain the methods together like:
|
|
74
74
|
|
75
75
|
== Setting defaults
|
76
76
|
|
77
|
-
It is possible to set default values that will be used in every method in your
|
77
|
+
It is possible to set default values that will be used in every method in your
|
78
|
+
Action Mailer class. To implement this functionality, you just call the public
|
79
|
+
class method +default+ which you get for free from <tt>ActionMailer::Base</tt>.
|
80
|
+
This method accepts a Hash as the parameter. You can use any of the headers,
|
81
|
+
email messages have, like +:from+ as the key. You can also pass in a string as
|
82
|
+
the key, like "Content-Type", but Action Mailer does this out of the box for you,
|
83
|
+
so you won't need to worry about that. Finally, it is also possible to pass in a
|
84
|
+
Proc that will get evaluated when it is needed.
|
78
85
|
|
79
|
-
Note that every value you set with this method will get overwritten if you use the
|
86
|
+
Note that every value you set with this method will get overwritten if you use the
|
87
|
+
same key in your mailer method.
|
80
88
|
|
81
89
|
Example:
|
82
90
|
|
@@ -87,10 +95,11 @@ Example:
|
|
87
95
|
|
88
96
|
== Receiving emails
|
89
97
|
|
90
|
-
To receive emails, you need to implement a public instance method called
|
91
|
-
email object as its single parameter. The Action Mailer
|
92
|
-
|
93
|
-
|
98
|
+
To receive emails, you need to implement a public instance method called
|
99
|
+
+receive+ that takes an email object as its single parameter. The Action Mailer
|
100
|
+
framework has a corresponding class method, which is also called +receive+, that
|
101
|
+
accepts a raw, unprocessed email as a string, which it then turns into the email
|
102
|
+
object and calls the receive instance method.
|
94
103
|
|
95
104
|
Example:
|
96
105
|
|
@@ -111,13 +120,14 @@ Example:
|
|
111
120
|
end
|
112
121
|
end
|
113
122
|
|
114
|
-
This Mailman can be the target for Postfix or other MTAs. In Rails, you would use
|
115
|
-
trivial case like this:
|
123
|
+
This Mailman can be the target for Postfix or other MTAs. In Rails, you would use
|
124
|
+
the runner in the trivial case like this:
|
116
125
|
|
117
126
|
rails runner 'Mailman.receive(STDIN.read)'
|
118
127
|
|
119
|
-
However, invoking Rails in the runner for each mail to be received is very
|
120
|
-
instance of Rails should be run within a daemon, if
|
128
|
+
However, invoking Rails in the runner for each mail to be received is very
|
129
|
+
resource intensive. A single instance of Rails should be run within a daemon, if
|
130
|
+
it is going to process more than just a limited amount of email.
|
121
131
|
|
122
132
|
== Configuration
|
123
133
|
|
data/lib/action_mailer/base.rb
CHANGED
@@ -15,11 +15,17 @@ module ActionMailer
|
|
15
15
|
#
|
16
16
|
# $ rails generate mailer Notifier
|
17
17
|
#
|
18
|
-
# The generated model inherits from <tt>
|
18
|
+
# The generated model inherits from <tt>ApplicationMailer</tt> which in turn
|
19
|
+
# inherits from <tt>ActionMailer::Base</tt>. A mailer model defines methods
|
19
20
|
# used to generate an email message. In these methods, you can setup variables to be used in
|
20
21
|
# the mailer views, options on the mail itself such as the <tt>:from</tt> address, and attachments.
|
21
22
|
#
|
22
|
-
# class
|
23
|
+
# class ApplicationMailer < ActionMailer::Base
|
24
|
+
# default from: 'from@exmaple.com'
|
25
|
+
# layout 'mailer'
|
26
|
+
# end
|
27
|
+
#
|
28
|
+
# class Notifier < ApplicationMailer
|
23
29
|
# default from: 'no-reply@example.com',
|
24
30
|
# return_path: 'system@example.com'
|
25
31
|
#
|
@@ -84,7 +90,7 @@ module ActionMailer
|
|
84
90
|
# name as the method in your mailer model. For example, in the mailer defined above, the template at
|
85
91
|
# <tt>app/views/notifier/welcome.text.erb</tt> would be used to generate the email.
|
86
92
|
#
|
87
|
-
# Variables defined in the methods of your mailer model are accessible as instance variables in their
|
93
|
+
# Variables defined in the methods of your mailer model are accessible as instance variables in their
|
88
94
|
# corresponding view.
|
89
95
|
#
|
90
96
|
# Emails by default are sent in plain text, so a sample view for our model example might look like this:
|
@@ -178,7 +184,7 @@ module ActionMailer
|
|
178
184
|
#
|
179
185
|
# Sending attachment in emails is easy:
|
180
186
|
#
|
181
|
-
# class
|
187
|
+
# class Notifier < ApplicationMailer
|
182
188
|
# def welcome(recipient)
|
183
189
|
# attachments['free_book.pdf'] = File.read('path/to/file.pdf')
|
184
190
|
# mail(to: recipient, subject: "New account information")
|
@@ -194,7 +200,7 @@ module ActionMailer
|
|
194
200
|
# If you need to send attachments with no content, you need to create an empty view for it,
|
195
201
|
# or add an empty body parameter like this:
|
196
202
|
#
|
197
|
-
# class
|
203
|
+
# class Notifier < ApplicationMailer
|
198
204
|
# def welcome(recipient)
|
199
205
|
# attachments['free_book.pdf'] = File.read('path/to/file.pdf')
|
200
206
|
# mail(to: recipient, subject: "New account information", body: "")
|
@@ -206,7 +212,7 @@ module ActionMailer
|
|
206
212
|
# You can also specify that a file should be displayed inline with other HTML. This is useful
|
207
213
|
# if you want to display a corporate logo or a photo.
|
208
214
|
#
|
209
|
-
# class
|
215
|
+
# class Notifier < ApplicationMailer
|
210
216
|
# def welcome(recipient)
|
211
217
|
# attachments.inline['photo.png'] = File.read('path/to/photo.png')
|
212
218
|
# mail(to: recipient, subject: "Here is what we look like")
|
@@ -245,7 +251,7 @@ module ActionMailer
|
|
245
251
|
# Action Mailer provides some intelligent defaults for your emails, these are usually specified in a
|
246
252
|
# default method inside the class definition:
|
247
253
|
#
|
248
|
-
# class Notifier <
|
254
|
+
# class Notifier < ApplicationMailer
|
249
255
|
# default sender: 'system@example.com'
|
250
256
|
# end
|
251
257
|
#
|
@@ -263,7 +269,7 @@ module ActionMailer
|
|
263
269
|
# As you can pass in any header, you need to either quote the header as a string, or pass it in as
|
264
270
|
# an underscored symbol, so the following will work:
|
265
271
|
#
|
266
|
-
# class Notifier <
|
272
|
+
# class Notifier < ApplicationMailer
|
267
273
|
# default 'Content-Transfer-Encoding' => '7bit',
|
268
274
|
# content_description: 'This is a description'
|
269
275
|
# end
|
@@ -271,7 +277,7 @@ module ActionMailer
|
|
271
277
|
# Finally, Action Mailer also supports passing <tt>Proc</tt> objects into the default hash, so you
|
272
278
|
# can define methods that evaluate as the message is being generated:
|
273
279
|
#
|
274
|
-
# class Notifier <
|
280
|
+
# class Notifier < ApplicationMailer
|
275
281
|
# default 'X-Special-Header' => Proc.new { my_method }
|
276
282
|
#
|
277
283
|
# private
|
@@ -296,7 +302,7 @@ module ActionMailer
|
|
296
302
|
# This may be useful, for example, when you want to add default inline attachments for all
|
297
303
|
# messages sent out by a certain mailer class:
|
298
304
|
#
|
299
|
-
# class Notifier <
|
305
|
+
# class Notifier < ApplicationMailer
|
300
306
|
# before_action :add_inline_attachment!
|
301
307
|
#
|
302
308
|
# def welcome
|
@@ -703,7 +709,7 @@ module ActionMailer
|
|
703
709
|
# The main method that creates the message and renders the email templates. There are
|
704
710
|
# two ways to call this method, with a block, or without a block.
|
705
711
|
#
|
706
|
-
# It accepts a headers hash. This hash allows you to specify
|
712
|
+
# It accepts a headers hash. This hash allows you to specify
|
707
713
|
# the most used headers in an email message, these are:
|
708
714
|
#
|
709
715
|
# * +:subject+ - The subject of the message, if this is omitted, Action Mailer will
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: actionmailer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 4.2.0.
|
4
|
+
version: 4.2.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-11-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: actionpack
|
@@ -16,82 +16,82 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 4.2.0.
|
19
|
+
version: 4.2.0.rc1
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 4.2.0.
|
26
|
+
version: 4.2.0.rc1
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: actionview
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - '='
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 4.2.0.
|
33
|
+
version: 4.2.0.rc1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - '='
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 4.2.0.
|
40
|
+
version: 4.2.0.rc1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activejob
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 4.2.0.
|
47
|
+
version: 4.2.0.rc1
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 4.2.0.
|
54
|
+
version: 4.2.0.rc1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: mail
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '2.5'
|
62
|
-
- -
|
62
|
+
- - ">="
|
63
63
|
- !ruby/object:Gem::Version
|
64
64
|
version: 2.5.4
|
65
65
|
type: :runtime
|
66
66
|
prerelease: false
|
67
67
|
version_requirements: !ruby/object:Gem::Requirement
|
68
68
|
requirements:
|
69
|
-
- - ~>
|
69
|
+
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '2.5'
|
72
|
-
- -
|
72
|
+
- - ">="
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: 2.5.4
|
75
75
|
- !ruby/object:Gem::Dependency
|
76
76
|
name: rails-dom-testing
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
78
78
|
requirements:
|
79
|
-
- - ~>
|
79
|
+
- - "~>"
|
80
80
|
- !ruby/object:Gem::Version
|
81
81
|
version: '1.0'
|
82
|
-
- -
|
82
|
+
- - ">="
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 1.0.
|
84
|
+
version: 1.0.5
|
85
85
|
type: :runtime
|
86
86
|
prerelease: false
|
87
87
|
version_requirements: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
|
-
- - ~>
|
89
|
+
- - "~>"
|
90
90
|
- !ruby/object:Gem::Version
|
91
91
|
version: '1.0'
|
92
|
-
- -
|
92
|
+
- - ">="
|
93
93
|
- !ruby/object:Gem::Version
|
94
|
-
version: 1.0.
|
94
|
+
version: 1.0.5
|
95
95
|
description: Email on Rails. Compose, deliver, receive, and test emails using the
|
96
96
|
familiar controller/view pattern. First-class support for multipart email and attachments.
|
97
97
|
email: david@loudthinking.com
|
@@ -118,6 +118,7 @@ files:
|
|
118
118
|
- lib/action_mailer/version.rb
|
119
119
|
- lib/rails/generators/mailer/USAGE
|
120
120
|
- lib/rails/generators/mailer/mailer_generator.rb
|
121
|
+
- lib/rails/generators/mailer/templates/application_mailer.rb
|
121
122
|
- lib/rails/generators/mailer/templates/mailer.rb
|
122
123
|
homepage: http://www.rubyonrails.org
|
123
124
|
licenses:
|
@@ -129,18 +130,18 @@ require_paths:
|
|
129
130
|
- lib
|
130
131
|
required_ruby_version: !ruby/object:Gem::Requirement
|
131
132
|
requirements:
|
132
|
-
- -
|
133
|
+
- - ">="
|
133
134
|
- !ruby/object:Gem::Version
|
134
135
|
version: 1.9.3
|
135
136
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
136
137
|
requirements:
|
137
|
-
- -
|
138
|
+
- - ">"
|
138
139
|
- !ruby/object:Gem::Version
|
139
140
|
version: 1.3.1
|
140
141
|
requirements:
|
141
142
|
- none
|
142
143
|
rubyforge_project:
|
143
|
-
rubygems_version: 2.2.
|
144
|
+
rubygems_version: 2.2.2
|
144
145
|
signing_key:
|
145
146
|
specification_version: 4
|
146
147
|
summary: Email composition, delivery, and receiving framework (part of Rails).
|