Module: MailerInterceptorModule

Included in:
WhitelistRecipients::MailerInterceptor
Defined in:
lib/whitelist_recipients/mailer_interceptor.rb

Overview

methods to whitelist email address

Instance Method Summary collapse

Instance Method Details

#delivering_email(message) ⇒ Object

whitelist email addresses



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/whitelist_recipients/mailer_interceptor.rb', line 6

def delivering_email(message)
  return unless message.perform_deliveries
  return unless !!Rails.application.config.action_mailer&.smtp_settings

  smtp_settings = Rails.application.config.action_mailer.smtp_settings
  whitelist = smtp_settings[:whitelist_email_addresses]
  whitelist_cc = smtp_settings[:whitelist_mailer_cc]
  whitelist_bcc = smtp_settings[:whitelist_mailer_bcc]

  finalize_email_addresses(whitelist, message)

  finalize_cc(whitelist_cc, message)

  finalize_bcc(whitelist_bcc, message)
end