demarches-normaliennes/app/mailers/gestionnaire_mailer.rb

45 lines
1.1 KiB
Ruby
Raw Normal View History

2016-02-09 11:00:13 +01:00
class GestionnaireMailer < ApplicationMailer
2017-06-27 17:58:16 +02:00
layout 'mailers/layout'
def invite_gestionnaire(gestionnaire, reset_password_token)
@reset_password_token = reset_password_token
@gestionnaire = gestionnaire
subject = "Activez votre compte accompagnateur"
2018-05-31 23:58:10 +02:00
mail(to: gestionnaire.email,
2018-05-31 15:26:02 +02:00
subject: subject,
2018-05-31 15:43:57 +02:00
reply_to: CONTACT_EMAIL)
end
def user_to_gestionnaire(email)
2018-05-31 15:50:13 +02:00
subject = "Vous avez été nommé accompagnateur"
2018-05-31 15:26:02 +02:00
send_mail(email, nil, subject)
2016-02-09 11:00:13 +01:00
end
def last_week_overview(gestionnaire)
headers['X-mailjet-campaign'] = 'last_week_overview'
overview = gestionnaire.last_week_overview
2018-05-31 15:50:13 +02:00
subject = 'Votre activité hebdomadaire'
2018-05-31 23:58:10 +02:00
2018-05-31 15:26:02 +02:00
send_mail(gestionnaire.email, overview, subject)
end
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-05-31 15:52:50 +02:00
def send_mail(email, args, subject)
@args = args
2016-02-09 11:00:13 +01:00
@email = email
mail(to: email, subject: subject)
2016-02-09 11:00:13 +01:00
end
end