Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Multipart templates made easy with Markdown + ERb

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 gemfiles Fix gem path for Rails 4.0 to run the tests March 04, 2014
Octocat-spinner-32 lib Update to Rails 4.1 rc1 March 04, 2014
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore First release of markerb. April 26, 2011
Octocat-spinner-32 .travis.yml Update to Rails 4.1 rc1 March 04, 2014
Octocat-spinner-32 Gemfile Update to Rails 4.1 rc1 March 04, 2014
Octocat-spinner-32 Gemfile.lock Update to Rails 4.1 rc1 March 04, 2014
Octocat-spinner-32 MIT-LICENSE Update copyright year January 03, 2014
Octocat-spinner-32 README.md Update copyright year January 03, 2014
Octocat-spinner-32 Rakefile Bump dependencies, fix rakefile November 22, 2012
Octocat-spinner-32 markerb.gemspec Update gemspec January 03, 2014
README.md

Markerb

Build Status

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.

The usage is quite simple. Assuming you have a notifier as below:

class Notifier < ActionMailer::Base
  def contact(recipient)
    @recipient = recipient
    mail(:to => @recipient, :from => "john.doe@example.com") do |format|
      format.text
      format.html
    end
  end
end

If you create a template at app/views/notifier/contact.markerb:

Multipart templates **rocks**, right <%= @recipient %>?!

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:

  • 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;

  • The order of the parts matter. It is important for e-mail clients that you call format.text before you call format.html;

  • Notice you can normally use ERb inside the template.

Enjoy!

Bug reports

If you discover any bugs, feel free to create an issue on GitHub. Please add as much information as possible to help us fixing the possible bug. We also encourage you to help even more by forking and sending us a pull request.

https://github.com/plataformatec/markerb/issues

Maintainers

License

MIT License. Copyright 2011-2014 Plataformatec. http://plataformatec.com.br

Something went wrong with that request. Please try again.