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:48:36 +02:00
|
|
|
subject = "Participez à l'élaboration d'un dossier"
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2018-05-31 15:53:04 +02:00
|
|
|
if invite.user.present?
|
|
|
|
send_mail(invite, subject, invite.email_sender)
|
|
|
|
end
|
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:50:13 +02:00
|
|
|
subject = "#{invite.email_sender} vous invite à consulter un dossier"
|
2016-02-08 18:16:18 +01:00
|
|
|
|
2018-05-31 15:52:50 +02:00
|
|
|
send_mail(invite, subject, invite.email_sender)
|
2016-02-08 18:16:18 +01:00
|
|
|
end
|
|
|
|
|
|
|
|
private
|
|
|
|
|
2018-05-31 15:52:50 +02:00
|
|
|
def send_mail(invite, subject, reply_to)
|
2016-02-08 18:16:18 +01:00
|
|
|
@invite = invite
|
2018-05-31 15:52:50 +02:00
|
|
|
email = invite.email
|
2016-02-08 18:16:18 +01:00
|
|
|
|
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
|