Sha256: 4b197f8df7a55809048f1666844b291e06e8b15cf3a39af6a748319d2fd68178

Contents?: true

Size: 748 Bytes

Versions: 37

Compression:

Stored size: 748 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
  class MailInterceptor

    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

  end
end

Version data entries

37 entries across 37 versions & 6 rubygems

Version Path
spree_core-0.70.7 lib/spree/mail_interceptor.rb
spree_core-0.70.6 lib/spree/mail_interceptor.rb
apispree_core-0.0.0 lib/spree/mail_interceptor.rb
My-Commerce_core-1.1.0 lib/spree/mail_interceptor.rb
My-Commerce_core-1.0.0 lib/spree/mail_interceptor.rb
MyCommerceapi-1.0.0 core/lib/spree/mail_interceptor.rb
MyCommerce-0.0.3 core/lib/spree/mail_interceptor.rb
rfcommerce_core-0.0.3 lib/spree/mail_interceptor.rb
spree_core-0.60.6 lib/spree/mail_interceptor.rb
spree_core-0.70.5 lib/spree/mail_interceptor.rb
spree_core-0.70.4 lib/spree/mail_interceptor.rb
spree_core-0.60.5 lib/spree/mail_interceptor.rb
spree_core-0.70.3 lib/spree/mail_interceptor.rb
spree_core-0.70.2 lib/spree/mail_interceptor.rb
spree_core-0.30.2 lib/spree/mail_interceptor.rb
spree_core-0.40.4 lib/spree/mail_interceptor.rb
spree_core-0.50.4 lib/spree/mail_interceptor.rb
spree_core-0.60.4 lib/spree/mail_interceptor.rb
spree_core-0.50.3 lib/spree/mail_interceptor.rb
spree_core-0.60.3 lib/spree/mail_interceptor.rb