2016-02-08 18:16:18 +01:00
|
|
|
class InviteMailer < ApplicationMailer
|
2018-03-20 17:47:37 +01:00
|
|
|
def invite_user(invite)
|
2018-05-31 15:26:07 +02:00
|
|
|
vars_mailer(invite)
|
2018-05-31 15:26:02 +02:00
|
|
|
subject = "demarches-simplifiees.fr - Participez à l'élaboration d'un dossier"
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2018-05-31 15:26:02 +02:00
|
|
|
send_mail(invite.email, subject, invite.email_sender) if invite.user.present?
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
|
2018-03-20 17:47:37 +01:00
|
|
|
def invite_guest(invite)
|
2018-05-31 15:26:07 +02:00
|
|
|
vars_mailer(invite)
|
2018-05-31 15:26:02 +02:00
|
|
|
subject = "Invitation - #{invite.email_sender} vous invite à consulter un dossier sur demarches-simplifiees.fr"
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2018-05-31 15:26:02 +02:00
|
|
|
send_mail(invite.email, subject, invite.email_sender)
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-03-20 17:47:37 +01:00
|
|
|
def vars_mailer(invite)
|
2016-02-08 18:16:18 +01:00
|
|
|
@invite = invite
|
|
|
|
end
|
|
|
|
|
2018-03-20 17:47:37 +01:00
|
|
|
def send_mail(email, subject, reply_to)
|
2017-05-11 18:24:43 +02:00
|
|
|
mail(to: email,
|
2016-11-17 12:17:59 +01:00
|
|
|
subject: subject,
|
|
|
|
reply_to: reply_to)
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
end
|