2016-02-09 11:00:13 +01:00
|
|
|
class GestionnaireMailer < ApplicationMailer
|
2017-06-27 17:58:16 +02:00
|
|
|
layout 'mailers/layout'
|
|
|
|
|
2018-04-27 12:29:01 +02:00
|
|
|
def invite_gestionnaire(gestionnaire, reset_password_token)
|
|
|
|
@reset_password_token = reset_password_token
|
|
|
|
@gestionnaire = gestionnaire
|
|
|
|
mail(to: gestionnaire.email,
|
|
|
|
subject: "demarches-simplifiees.fr - Activez votre compte accompagnateur",
|
|
|
|
reply_to: "contact@demarches-simplifiees.fr")
|
2018-04-11 19:37:53 +02:00
|
|
|
end
|
|
|
|
|
|
|
|
def user_to_gestionnaire(email)
|
|
|
|
send_mail(email, nil, "Vous avez été nommé accompagnateur sur demarches-simplifiees.fr")
|
2016-02-09 11:00:13 +01:00
|
|
|
end
|
|
|
|
|
2018-02-21 17:40:41 +01:00
|
|
|
def last_week_overview(gestionnaire)
|
2017-05-17 10:27:08 +02:00
|
|
|
headers['X-mailjet-campaign'] = 'last_week_overview'
|
2018-02-21 17:40:41 +01:00
|
|
|
overview = gestionnaire.last_week_overview
|
2018-02-28 16:01:20 +01:00
|
|
|
send_mail gestionnaire.email, overview, 'Vos activités sur demarches-simplifiees.fr'
|
2017-05-12 16:56:46 +02:00
|
|
|
end
|
|
|
|
|
2018-01-30 19:11:07 +01:00
|
|
|
def send_dossier(sender, dossier, recipient)
|
|
|
|
@sender = sender
|
|
|
|
@dossier = dossier
|
|
|
|
subject = "#{sender.email} vous a envoyé le dossier nº #{dossier.id}"
|
|
|
|
|
|
|
|
mail(to: recipient.email, subject: subject)
|
|
|
|
end
|
|
|
|
|
2016-02-09 11:00:13 +01:00
|
|
|
private
|
|
|
|
|
2018-03-20 17:47:37 +01:00
|
|
|
def vars_mailer(email, args)
|
2016-05-24 16:39:39 +02:00
|
|
|
@args = args
|
2016-02-09 11:00:13 +01:00
|
|
|
@email = email
|
|
|
|
end
|
|
|
|
|
2018-03-20 17:47:37 +01:00
|
|
|
def send_mail(email, args, subject)
|
2016-05-24 16:39:39 +02:00
|
|
|
vars_mailer email, args
|
2016-02-09 11:00:13 +01:00
|
|
|
|
2017-05-11 18:24:43 +02:00
|
|
|
mail(to: email, subject: subject)
|
2016-02-09 11:00:13 +01:00
|
|
|
end
|
|
|
|
end
|