Class: Spree::MailInterceptor

Inherits:
Object
  • Object
show all
Defined in:
lib/spree/mail_interceptor.rb

Class Method Summary collapse

Class Method Details

.delivering_email(message) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/spree/mail_interceptor.rb', line 8

def self.delivering_email(message)
  return unless mail_method = MailMethod.current
  message.from ||= mail_method.preferred_mails_from

  if mail_method.preferred_intercept_email.present?
    message.subject = "[#{message.to}] #{message.subject}"
    message.to = mail_method.preferred_intercept_email
  end

  if mail_method.preferred_mail_bcc.present?
    message.bcc = mail_method.preferred_mail_bcc
  end
end