demarches-normaliennes/app/mailers/gestionnaire_mailer.rb

35 lines
851 B
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'
2016-02-09 11:00:13 +01:00
def new_gestionnaire email, password
send_mail email, password, "Vous avez été nommé accompagnateur sur la plateforme TPS"
end
def last_week_overview(gestionnaire)
headers['X-mailjet-campaign'] = 'last_week_overview'
overview = gestionnaire.last_week_overview
2017-06-27 18:00:48 +02:00
send_mail gestionnaire.email, overview, 'Vos activités sur TPS'
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
def vars_mailer email, args
@args = args
2016-02-09 11:00:13 +01:00
@email = email
end
def send_mail email, args, subject
vars_mailer email, args
2016-02-09 11:00:13 +01:00
mail(to: email, subject: subject)
2016-02-09 11:00:13 +01:00
end
end