Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 50 lines (32 sloc) 1.574 kb
f4bc1db @tmaier Convert README to Markdown
tmaier authored
1 # Markerb
e146118 @josevalim First release of markerb.
josevalim authored
2
b345b58 @tmaier Improve README
tmaier authored
3 **Markerb** allows you to render multipart e-mails from a single template. The template is written in Markdown, which is delivered as a text part, but also rendered and delivered as an HTML part.
e146118 @josevalim First release of markerb.
josevalim authored
4
5 The usage is quite simple. Assuming you have a notifier as below:
6
b345b58 @tmaier Improve README
tmaier authored
7 ```ruby
8 class Notifier < ActionMailer::Base
9 def contact(recipient)
10 @recipient = recipient
11 mail(:to => @recipient, :from => "john.doe@example.com") do |format|
12 format.text
13 format.html
e146118 @josevalim First release of markerb.
josevalim authored
14 end
b345b58 @tmaier Improve README
tmaier authored
15 end
16 end
17 ```
e146118 @josevalim First release of markerb.
josevalim authored
18
f4bc1db @tmaier Convert README to Markdown
tmaier authored
19 If you create a template at `app/views/notifier/contact.markerb`:
e146118 @josevalim First release of markerb.
josevalim authored
20
b345b58 @tmaier Improve README
tmaier authored
21 ```erb
22 Multipart templates **rocks**, right <%= @recipient %>?!
23 ```
e146118 @josevalim First release of markerb.
josevalim authored
24
df44919 @josevalim Edited README.rdoc via GitHub
josevalim authored
25 It will generate two parts, one in text and another in html when delivered. Before we finish, here are a few things you might need to know:
e146118 @josevalim First release of markerb.
josevalim authored
26
f4bc1db @tmaier Convert README to Markdown
tmaier authored
27 * The `contact.markerb` template should not have a format in its name. Adding a format would make it unavailable to be rendered in different formats;
e146118 @josevalim First release of markerb.
josevalim authored
28
f4bc1db @tmaier Convert README to Markdown
tmaier authored
29 * The order of the parts matter. It is important for e-mail clients that you call `format.text` before you call `format.html`;
e146118 @josevalim First release of markerb.
josevalim authored
30
31 * Notice you can normally use ERb inside the template.
32
33 Enjoy!
34
b345b58 @tmaier Improve README
tmaier authored
35 ## Bug reports
e146118 @josevalim First release of markerb.
josevalim authored
36
b345b58 @tmaier Improve README
tmaier authored
37 If you discover any bugs, feel free to create an issue on GitHub. Please add as much information as
38 possible to help us fixing the possible bug. We also encourage you to help even more by forking and
39 sending us a pull request.
40
41 https://github.com/plataformatec/markerb/issues
42
43 ## Maintainers
44
45 * José Valim (https://github.com/josevalim)
46
47 ## License
48
49 MIT License. Copyright 2012 Plataforma Tecnologia. http://blog.plataformatec.com.br
Something went wrong with that request. Please try again.