@@ -5,7 +5,7 @@ are used to consolidate code for sending out forgotten passwords, welcome
5
5
wishes on signup, invoices for billing, and any other use case that requires
6
6
a written notification to either a person or another system.
7
7
8
- Action Mailer is in essence a wrapper around Action Controller and the
8
+ Action Mailer is in essence a wrapper around Action Controller and the
9
9
Mail gem. It provides a way to make emails using templates in the same
10
10
way that Action Controller renders views using templates.
11
11
@@ -23,7 +23,7 @@ This can be as simple as:
23
23
24
24
class Notifier < ActionMailer::Base
25
25
26
-
26
+
27
27
def welcome(recipient)
28
28
@recipient = recipient
29
29
mail(:to => recipient,
@@ -36,13 +36,13 @@ ERb) that has the instance variables that are declared in the mailer action.
36
36
37
37
So the corresponding body template for the method above could look like this:
38
38
39
- Hello there,
39
+ Hello there,
40
40
41
41
Mr. <%= @recipient %>
42
42
43
43
Thank you for signing up!
44
-
45
- And if the recipient was given as "
[email protected] ", the email
44
+
45
+ And if the recipient was given as "
[email protected] ", the email
46
46
generated would look like this:
47
47
48
48
Date: Mon, 25 Jan 2010 22:48:09 +1100
@@ -55,7 +55,7 @@ generated would look like this:
55
55
charset="US-ASCII";
56
56
Content-Transfer-Encoding: 7bit
57
57
58
- Hello there,
58
+ Hello there,
59
59
60
60
61
61
@@ -75,7 +75,7 @@ Or you can just chain the methods together like:
75
75
== Receiving emails
76
76
77
77
To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes a
78
- tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
78
+ tmail object as its single parameter. The Action Mailer framework has a corresponding class method,
79
79
which is also called <tt>receive</tt>, that accepts a raw, unprocessed email as a string, which it then turns
80
80
into the tmail object and calls the receive instance method.
81
81
@@ -90,21 +90,21 @@ Example:
90
90
91
91
if email.has_attachments?
92
92
for attachment in email.attachments
93
- page.attachments.create({
93
+ page.attachments.create({
94
94
:file => attachment, :description => email.subject
95
95
})
96
96
end
97
97
end
98
98
end
99
99
end
100
100
101
- This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
101
+ This Mailman can be the target for Postfix or other MTAs. In Rails, you would use the runner in the
102
102
trivial case like this:
103
103
104
104
rails runner 'Mailman.receive(STDIN.read)'
105
105
106
- However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
107
- instance of Rails should be run within a daemon if it is going to be utilized to process more than just
106
+ However, invoking Rails in the runner for each mail to be received is very resource intensive. A single
107
+ instance of Rails should be run within a daemon if it is going to be utilized to process more than just
108
108
a limited number of email.
109
109
110
110
== Configuration
0 commit comments