Read more

Action Mailer Previews

Judith Roth
January 12, 2015Software engineer at makandra GmbH

Rails includes a way to see what an e-mail will look like.

Integration to RSpec

Illustration web development

Do you need DevOps-experts?

Your development team has a full backlog? No time for infrastructure architecture? Our DevOps team is ready to support you!

  • We build reliable cloud solutions with Infrastructure as code
  • We are experts in security, Linux and databases
  • We support your dev team to perform
Read more Show snapshot

All you need to do is implement a preview-class in spec/mailers/previews/notifier_preview.rb:

class NotifierPreview < ActionMailer::Preview
  def welcome

And adapt the preview load path in your application.rb:

config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews" # this is already set as default by Rails

Then a preview will be available in the browser at http://localhost:3000/rails/mailers/notifier/welcome as well as a list of previews at http://localhost:3000/rails/mailers.

Rails <4.1

You could use Mailcatcher.

See also

Posted by Judith Roth to makandra dev (2015-01-12 14:33)