demarches-normaliennes/app/mailers/invite_mailer.rb

28 lines
638 B
Ruby
Raw Normal View History

# Preview all emails at http://localhost:3000/rails/mailers/invite_mailer
class InviteMailer < ApplicationMailer
def invite_user(invite)
subject = "Participez à l'élaboration d'un dossier"
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"
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
end