lib/sendgrid_actionmailer.rb in sendgrid-actionmailer-3.1.0 vs lib/sendgrid_actionmailer.rb in sendgrid-actionmailer-3.1.1
- old
+ new
@@ -236,11 +236,13 @@
sendgrid_mail.ip_pool_name = mail['ip_pool_name'].to_s
end
end
def add_mail_settings(sendgrid_mail, mail)
- if mail['mail_settings']
- settings = mail['mail_settings'].unparsed_value || {}
+ local_settings = mail['mail_settings'] && mail['mail_settings'].unparsed_value || {}
+ global_settings = self.settings[:mail_settings] || {}
+ settings = global_settings.merge(local_settings)
+ unless settings.empty?
sendgrid_mail.mail_settings = MailSettings.new.tap do |m|
if settings[:bcc]
m.bcc = BccSettings.new(**settings[:bcc])
end
if settings[:bypass_list_management]