Preview ActionMailer email content
(1) Assuming you already have a mailer action. E.g.
class NotificationMailer < ApplicationMailer def changed_password(email) mail(to: email, subject: 'Password Changed') end end
(2) Create a preview at /spec/mailers/previews/notification_mailer_preview.rb E.g.
class NotificationMailerPreview < ActionMailer::Preview def changed_password NotificationMailer.changed_password('email') end end
(3) Run the App in development.
(4) Visit localhost:3000/rails/mailers/notification_mailer/changed_password
You can now see a preview of the rendered email template.
AI Summary
Chrome On-device AI
2024-12-06 19:50:59
Share Article