diff options
author | Xavier Noria <fxn@hashref.com> | 2011-04-12 22:45:33 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2011-04-12 22:45:33 +0200 |
commit | 3366479a9a6db3101ffe3827a86be0e5b50f7a5a (patch) | |
tree | a9b4e813f32a99fa626152947862bb57edd23ed0 /actionmailer | |
parent | b53ffb35e085362bb2690577ae123a1f4872c12a (diff) | |
parent | 40d156955c82c19b14494c1bf60ad48980e29a4e (diff) | |
download | rails-3366479a9a6db3101ffe3827a86be0e5b50f7a5a.tar.gz rails-3366479a9a6db3101ffe3827a86be0e5b50f7a5a.tar.bz2 rails-3366479a9a6db3101ffe3827a86be0e5b50f7a5a.zip |
Merge branch 'master' of git://github.com/lifo/docrails
Diffstat (limited to 'actionmailer')
-rw-r--r-- | actionmailer/README.rdoc | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/actionmailer/README.rdoc b/actionmailer/README.rdoc index 14d20bb08d..9b206fbcc7 100644 --- a/actionmailer/README.rdoc +++ b/actionmailer/README.rdoc @@ -72,6 +72,19 @@ Or you can just chain the methods together like: Notifier.welcome.deliver # Creates the email and sends it immediately +== 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 wont 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 + default :from => "awesome@application.com", :subject => Proc.new { "E-mail was generated at #{Time.now}" } + ..... + end + == Receiving emails To receive emails, you need to implement a public instance method called <tt>receive</tt> that takes an |