Sha256: 7d9c734c756705def1d754cfe84bb0d6073810ae0ff75e24815c304b7ce6bd55

Contents?: true

Size: 804 Bytes

Versions: 17

Compression:

Stored size: 804 Bytes

Contents

# Allows us to intercept any outbound mail message and make last minute changes (such as specifying a "from" address or
# sending to a test email account.)
#
# See http://railscasts.com/episodes/206-action-mailer-in-rails-3 for more details.
module Spree
  module Core
    class MailInterceptor

      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

    end
  end
end

Version data entries

17 entries across 17 versions & 2 rubygems

Version Path
spree_core-1.2.5 lib/spree/core/mail_interceptor.rb
spree_core-1.1.6 lib/spree/core/mail_interceptor.rb
spree_core-1.1.5 lib/spree/core/mail_interceptor.rb
spree_core-1.2.4 lib/spree/core/mail_interceptor.rb
spree_core-1.3.2 lib/spree/core/mail_interceptor.rb
spree_core-1.2.3 lib/spree/core/mail_interceptor.rb
spree_core-1.3.1 lib/spree/core/mail_interceptor.rb
spree_core-1.3.0 lib/spree/core/mail_interceptor.rb
spree_core-1.3.0.rc2 lib/spree/core/mail_interceptor.rb
dup_spree_core-1.3.0.rc1 lib/spree/core/mail_interceptor.rb
spree_core-1.3.0.rc1 lib/spree/core/mail_interceptor.rb
spree_core-1.2.2 lib/spree/core/mail_interceptor.rb
spree_core-1.1.4 lib/spree/core/mail_interceptor.rb
spree_core-1.2.0 lib/spree/core/mail_interceptor.rb
spree_core-1.2.0.rc2 lib/spree/core/mail_interceptor.rb
spree_core-1.2.0.rc1 lib/spree/core/mail_interceptor.rb
spree_core-1.1.3 lib/spree/core/mail_interceptor.rb