Simplify mailers development with mailcatcher and previews

This commit is contained in:
Mathieu Magnin 2017-01-23 15:41:09 +01:00
parent 293e24e20e
commit 29de9b0b55
2 changed files with 14 additions and 1 deletions

View file

@ -39,9 +39,17 @@ Rails.application.configure do
# Raises helpful error messages.
config.assets.raise_runtime_errors = true
config.action_mailer.delivery_method = :test
# Action Mailer settings
config.action_mailer.delivery_method = :smtp
config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
# Config for mailcatcher https://mailcatcher.me/
config.action_mailer.smtp_settings = {
:address => "localhost",
:port => 1025,
:locale => 'fr'
}
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true

View file

@ -0,0 +1,5 @@
class NotificationMailerPreview < ActionMailer::Preview
def dossier_received
NotificationMailer.dossier_received(Dossier.last)
end
end