demarches-normaliennes/app/mailers/invite_mailer.rb

40 lines
1.3 KiB
Ruby
Raw Normal View History

# Preview all emails at http://localhost:3000/rails/mailers/invite_mailer
class InviteMailer < ApplicationMailer
2018-12-20 09:49:41 +01:00
layout 'mailers/layout'
def invite_user(invite)
2021-05-26 15:16:30 +02:00
subject = "Participez à l'élaboration dun dossier"
targeted_user_link = invite.targeted_user_link || invite.create_targeted_user_link(target_context: 'invite',
target_model: invite,
user: invite.user)
@url = targeted_user_link_url(targeted_user_link)
2018-05-31 15:53:04 +02:00
if invite.user.present?
send_mail(invite, subject, invite.email_sender)
end
end
def invite_guest(invite)
2018-05-31 15:50:13 +02:00
subject = "#{invite.email_sender} vous invite à consulter un dossier"
targeted_user_link = invite.targeted_user_link || invite.create_targeted_user_link(target_context: 'invite',
target_model: invite)
@url = targeted_user_link_url(targeted_user_link)
2018-05-31 15:52:50 +02:00
send_mail(invite, subject, invite.email_sender)
end
private
2018-05-31 15:52:50 +02:00
def send_mail(invite, subject, reply_to)
@invite = invite
2018-05-31 15:52:50 +02:00
email = invite.email
mail(to: email,
subject: subject,
reply_to: reply_to)
end
def forced_delivery_for_action?
true
end
end