Class: Spree::Core::MailInterceptor

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

Class Method Summary collapse

Class Method Details

.delivering_email(message) ⇒ Object



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

def self.delivering_email(message)
  return unless mail_method = Spree::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