mailers: add a NO_REPLY address to transactional emails
This commit is contained in:
parent
aa1cf6788b
commit
dd6c6bfe7a
6 changed files with 17 additions and 3 deletions
|
@ -7,4 +7,9 @@ class DeviseUserMailer < Devise::Mailer
|
|||
def template_paths
|
||||
['devise_mailer']
|
||||
end
|
||||
|
||||
def confirmation_instructions(record, token, opts = {})
|
||||
opts[:from] = NO_REPLY_EMAIL
|
||||
super
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,7 +12,7 @@ class DossierMailer < ApplicationMailer
|
|||
|
||||
subject = "Retrouvez votre brouillon pour la démarche « #{dossier.procedure.libelle} »"
|
||||
|
||||
mail(to: dossier.user.email, subject: subject) do |format|
|
||||
mail(from: NO_REPLY_EMAIL, to: dossier.user.email, subject: subject) do |format|
|
||||
format.html { render layout: 'mailers/notifications_layout' }
|
||||
end
|
||||
end
|
||||
|
@ -24,7 +24,7 @@ class DossierMailer < ApplicationMailer
|
|||
|
||||
subject = "Nouveau message pour votre dossier nº #{dossier.id} (#{dossier.procedure.libelle})"
|
||||
|
||||
mail(to: dossier.user.email, subject: subject) do |format|
|
||||
mail(from: NO_REPLY_EMAIL, to: dossier.user.email, subject: subject) do |format|
|
||||
format.html { render layout: 'mailers/notifications_layout' }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -12,6 +12,7 @@ class NotificationMailer < ApplicationMailer
|
|||
helper MailerHelper
|
||||
|
||||
layout 'mailers/notifications_layout'
|
||||
default from: NO_REPLY_EMAIL
|
||||
|
||||
def send_dossier_received(dossier)
|
||||
send_notification(dossier, dossier.procedure.received_mail_template)
|
||||
|
|
|
@ -2,7 +2,7 @@ if !defined?(CONTACT_EMAIL)
|
|||
CONTACT_EMAIL = "contact@demarches-simplifiees.fr"
|
||||
EQUIPE_EMAIL = "equipe@demarches-simplifiees.fr"
|
||||
TECH_EMAIL = "tech@demarches-simplifiees.fr"
|
||||
|
||||
NO_REPLY_EMAIL = "Ne pas répondre <ne-pas-repondre@demarches-simplifiees.fr>"
|
||||
CONTACT_PHONE = "01 76 42 02 87"
|
||||
|
||||
OLD_CONTACT_EMAIL = "contact@tps.apientreprise.fr"
|
||||
|
|
|
@ -4,6 +4,10 @@ RSpec.describe DossierMailer, type: :mailer do
|
|||
let(:to_email) { 'instructeur@exemple.gouv.fr' }
|
||||
|
||||
shared_examples 'a dossier notification' do
|
||||
it 'is sent from a no-reply address' do
|
||||
expect(subject.from.first).to eq(Mail::Address.new(NO_REPLY_EMAIL).address)
|
||||
end
|
||||
|
||||
it 'includes the contact informations in the footer' do
|
||||
expect(subject.body).to include('ne pas répondre')
|
||||
end
|
||||
|
|
|
@ -56,5 +56,9 @@ RSpec.describe NotificationMailer, type: :mailer do
|
|||
expect(mail.body).not_to include('iframe')
|
||||
end
|
||||
end
|
||||
|
||||
it 'sends the mail from a no-reply address' do
|
||||
expect(subject.from.first).to eq(Mail::Address.new(NO_REPLY_EMAIL).address)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Reference in a new issue