module Roda::RodaPlugins::MailerPreview

The mailer_preview plugin provides an HTML representation of the email without requiring it to be delivered through SMTP.

plugin :mailer_preview

Preview email

To preview an email, create a route which finishes by calling preview with an instance of a Mail object.

r.on "previews" do
  r.is "signup-email" do
    mail = YourMailer.mail("/signup-email")
    preview(mail)
  end
end

Preview index

For a single point of entry to all your mail previews, provide an array of paths to preview_index

r.is "previews" do
  available_previews = ["/previews/signup-email"]
  preview_index(available_previews)
end