Skip to content

Commit

Permalink
update backend to send to all emails specified in To field in email t…
Browse files Browse the repository at this point in the history
…emplate
  • Loading branch information
ArushC committed Feb 20, 2024
1 parent b1173d2 commit 870491a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions app/mailers/teacher_mailer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ class TeacherMailer < ApplicationMailer
def welcome_email(teacher)
@teacher = teacher
set_body
mail to: teacher.email_name,
set_recipients
mail to: @recipients, #ActionMailer accepts comma-separated lists of emails
cc: CONTACT_EMAIL,
subject: email_template.subject
end
Expand All @@ -20,7 +21,8 @@ def deny_email(teacher, denial_reason)
@teacher = teacher
@denial_reason = denial_reason
set_body
mail to: @teacher.email_name,
set_recipients
mail to: @recipients,
cc: CONTACT_EMAIL,
subject: email_template.subject
end
Expand All @@ -29,7 +31,8 @@ def request_info_email(teacher, request_reason)
@teacher = teacher
@request_reason = request_reason
set_body
mail to: @teacher.email_name,
set_recipients
mail to: @recipients,
cc: CONTACT_EMAIL,
subject: email_template.subject
end
Expand Down Expand Up @@ -58,7 +61,14 @@ def email_template
@email_template ||= EmailTemplate.find_by(title: action_name.titlecase)
end

#renders the email body with the {{parameter}} things
def set_body
@body = Liquid::Template.parse(email_template.body).render(liquid_assigns).html_safe
end

#renders the list of recipients with the {{parameter}} things
def set_recipients
@recipients = Liquid::Template.parse(email_template.to).render(liquid_assigns).html_safe
end

end

0 comments on commit 870491a

Please sign in to comment.