diff options
Diffstat (limited to 'actionmailer/README.rdoc')
-rw-r--r-- | actionmailer/README.rdoc | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index dc74b590f7..cf10bfffdb 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -22,12 +22,12 @@ the email. This can be as simple as: class Notifier < ActionMailer::Base - delivers_from 'system@loudthinking.com' + default from: 'system@loudthinking.com' def welcome(recipient) @recipient = recipient - mail(:to => recipient, - :subject => "[Signed up] Welcome #{recipient}") + mail(to: recipient, + subject: "[Signed up] Welcome #{recipient}") end end @@ -42,7 +42,7 @@ So the corresponding body template for the method above could look like this: Thank you for signing up! -And if the recipient was given as "david@loudthinking.com", the email +If the recipient was given as "david@loudthinking.com", the email generated would look like this: Date: Mon, 25 Jan 2010 22:48:09 +1100 @@ -62,7 +62,7 @@ generated would look like this: Thank you for signing up! In previous version of Rails you would call <tt>create_method_name</tt> and -<tt>deliver_method_name</tt>. Rails 3.0 has a much simpler interface, you +<tt>deliver_method_name</tt>. Rails 3.0 has a much simpler interface - you simply call the method and optionally call +deliver+ on the return value. Calling the method returns a Mail Message object: @@ -76,13 +76,13 @@ Or you can just chain the methods together like: == Setting defaults -It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally it is also possible to pass in a Proc that will get evaluated when it is needed. +It is possible to set default values that will be used in every method in your Action Mailer class. To implement this functionality, you just call the public class method <tt>default</tt> which you get for free from ActionMailer::Base. This method accepts a Hash as the parameter. You can use any of the headers e-mail messages has, like <tt>:from</tt> as the key. You can also pass in a string as the key, like "Content-Type", but Action Mailer does this out of the box for you, so you won't need to worry about that. Finally, it is also possible to pass in a Proc that will get evaluated when it is needed. Note that every value you set with this method will get over written if you use the same key in your mailer method. Example: - class Authenticationmailer < ActionMailer::Base + class AuthenticationMailer < ActionMailer::Base default :from => "awesome@application.com", :subject => Proc.new { "E-mail was generated at #{Time.now}" } ..... end @@ -148,7 +148,9 @@ Source code can be downloaded as part of the Rails project on GitHub == License -Action Mailer is released under the MIT license. +Action Mailer is released under the MIT license: + +* http://www.opensource.org/licenses/MIT == Support |