Falling back to OSEM_EMAIL_ADDRESS
This commit is contained in:
parent
18be2ea93a
commit
654ba706f4
2 changed files with 9 additions and 1 deletions
|
|
@ -81,6 +81,7 @@ module Admin
|
||||||
|
|
||||||
recipients.each do |user|
|
recipients.each do |user|
|
||||||
Mailbot.bulk_mail(@conference, user, subject, body).deliver_later
|
Mailbot.bulk_mail(@conference, user, subject, body).deliver_later
|
||||||
|
Rails.logger.info "Bulk email queued - Subject: '#{subject}' - Recipient: #{user.email}"
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to admin_conference_emails_path(@conference.short_title),
|
redirect_to admin_conference_emails_path(@conference.short_title),
|
||||||
|
|
|
||||||
|
|
@ -139,8 +139,15 @@ class Mailbot < ActionMailer::Base
|
||||||
end
|
end
|
||||||
|
|
||||||
def bulk_mail(conference, user, subject, body)
|
def bulk_mail(conference, user, subject, body)
|
||||||
|
from_email = conference.contact&.email.presence ||
|
||||||
|
ENV['OSEM_EMAIL_ADDRESS'] ||
|
||||||
|
Rails.application.config.action_mailer.smtp_settings&.dig(:user_name) ||
|
||||||
|
'noreply@osem.example.com'
|
||||||
|
|
||||||
|
Rails.logger.info "Bulk email delivered - Subject: '#{subject}' - From: #{from_email} - Recipient: #{user.email}"
|
||||||
|
|
||||||
mail(to: user.email,
|
mail(to: user.email,
|
||||||
from: conference.contact.email,
|
from: from_email,
|
||||||
subject: subject,
|
subject: subject,
|
||||||
body: EmailSettings.new.generate_email_on_conf_updates(conference, user, body))
|
body: EmailSettings.new.generate_email_on_conf_updates(conference, user, body))
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue