0.01
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Preview mailer templates in the browser.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

~> 3.1
 Project Readme

letter_bomb Build Status

Emails are pretty dangerous - inspect your mailer templates from the safety of your browser.

Install

Add to your Gemfile:

gem "letter_bomb", group: :development

and bundle away.

Usage

Mount the engine in your routes.rb:

if Rails.env.development?
  mount LetterBomb::Engine, at: "/letter_bomb"
end

and hit /letter_bomb for a list of previews.

Previews can be defined anywhere within app/mailers suffixed with preview, i.e. app/mailers/user_mailer_preview.rb. Preview method names are arbitrary so long as they return a Mail object.

class UserMailerPreview < LetterBomb::Preview
  def welcome
    WelcomeMailer.for_user(User.last)
  end
end

Preview methods are wrapped in an ActiveRecord transaction block that will be rolled back after execution, so it's safe to create your own test data within them.

Contributors

Alternatives

Rails 4 introduced ActionMailer::Preview, which should be preferred if available.