3

I can't preview my emails, at http://localhost:3000/rails/mailers/user_mailer

I always get this error: Mailer preview 'user_mailer' not found

spec/previews/user_mailer_preview.rb

class UserMailerPreview < ActionMailer::Preview
  def contact_form
    UserMailer.contact_form("[email protected]", "John", "Hello World!")
  end
end

I tried to add:

config.action_mailer.preview_path = "#{Rails.root}/spec/previews"

but it didn't work.

Any ideas how to solve this problem?

1

2 Answers 2

6

Try moving the file to spec/mailers/previews/user_mailer_preview.rb.

1

Another option would be to change the path in environments/development.rb to:

config.action_mailer.preview_path = "#{Rails.root}/spec/mailers/previews"

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.