./lib/lux/mailer/README.md in lux-fw-0.5.37 vs ./lib/lux/mailer/README.md in lux-fw-0.6.2
- old
+ new
@@ -1,7 +1,9 @@
-## Lux::Mailer - send mails
+## Lux::Mailer
+Light wrapper arrond [ruby mailer gem](https://github.com/mikel/mail).
+
* before and after class methods are supported
* before is called mail rendering started
* after is called after rendering but just before mail is send
* similar as in rails, renders mail as any other template
* based on ruby mail gem
@@ -14,11 +16,11 @@
* render template app/views/mailer/forgot_password
* render layout tempplate app/views/mailer/layout
* execute after filter
* deliver the mail
-### Example
+#### Example
sugessted usage
```ruby
Mailer.deliver(:email_login, 'foo@bar.baz')
@@ -37,17 +39,21 @@
```
Mailer.email_login('foo@bar.baz').deliver
Mailer.email_login('foo@bar.baz').body
```
-### Example code
+#### Code
```ruby
class Mailer < Lux::Mailer
helper :mailer
- # before mail is sent
+ # before method call
+ before do
+ end
+
+ # after method call, but before mail is sent
after do
mail.from = "#{App.name} <no-reply@#{Lux.config.host}>"
end
# raw define mail
@@ -65,9 +71,10 @@
# ./app/views/mailer/layout.haml
def lost_password email
mail.subject = "#{App.name} – potvrda registracije"
mail.to = email
- @link = "#{App.http_host}/profile/password?user_hash=#{Crypt.encrypt(email)}"
+ # instance variables will be pased to templaes
+ @link = "#{App.http_host}/profile/password?user_hash=#{Crypt.encrypt(email)}"
end
end
```
\ No newline at end of file