Advertisement
Guest User

Untitled

a guest
Dec 19th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Rails 0.98 KB | None | 0 0
  1. class UserMailer < ApplicationMailer
  2.  
  3.   def notificacion_evento_email(user, tutorando, tipo_destinatario)
  4.     if !user.nil? &&!tipo_destinatario.nil? && !tutorando.nil? && !tutorando.empty?
  5.       if Rails.env == 'production'
  6.         begin
  7.           if tipo_destinatario == 1
  8.             @email = user.email
  9.             @subject = 'Has registrado una cita de tutoría'
  10.             @message = "Has registrado un nuevo seguimiento de tutoría del día #{tutorando['fecha']} para el alumno #{tutorando['nombre']}."
  11.           elsif tipo_destinatario == 2
  12.             @email = "#{tutorando['matricula'][0].strip}@uach.mx"
  13.             @subject = 'Se registro una cita de tutoría'
  14.             @message = "El tutor #{user.full_name} ha registrado un nuevo seguimiento de tutoría del día #{tutorando['fecha']}."
  15.           end
  16.           mail(to: @email, subject: @subject)
  17.         rescue => e
  18.           Debug.exception e, 'notificacion_evento_email'
  19.         end
  20.       end
  21.     end
  22.   end
  23.  
  24. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement