Sha256: 7696e3f47bb1c86f1c63df359c545510f03192cf74a8ad0ec952005f306bfc31

Contents?: true

Size: 718 Bytes

Versions: 10

Compression:

Stored size: 718 Bytes

Contents

##
# Adds sending email through an ActiveRecord table as a delivery method for
# ActionMailer.
#

class ActionMailer::Base

  ##
  # Set the email class for deliveries. Handle class reloading issues which prevents caching the email class.
  #
  @@email_class_name = 'Email'

  def self.email_class=(klass)
    @@email_class_name = klass.to_s
  end

  def self.email_class
    @@email_class_name.constantize
  end

  ##
  # Adds +mail+ to the Email table.  Only the first From address for +mail+ is
  # used.

  def perform_delivery_activerecord(mail)
    mail.destinations.each do |destination|
      self.class.email_class.create :mail => mail.encoded, :to => destination, :from => mail.from.first
    end
  end

end

Version data entries

10 entries across 10 versions & 5 rubygems

Version Path
adzap-ar_mailer-2.1.3 lib/action_mailer/ar_mailer.rb
adzap-ar_mailer-2.1.4 lib/action_mailer/ar_mailer.rb
laserlemon-ar_mailer-2.1.5 lib/action_mailer/ar_mailer.rb
zendesk-ar_mailer-2.1.7 lib/action_mailer/ar_mailer.rb
zendesk-ar_mailer-2.1.6 lib/action_mailer/ar_mailer.rb
zendesk-ar_mailer-2.1.5 lib/action_mailer/ar_mailer.rb
axtro-ar_mailer-2.1.6 lib/action_mailer/ar_mailer.rb
adzap-ar_mailer-2.1.5 lib/action_mailer/ar_mailer.rb
axtro-ar_mailer-2.1.5 lib/action_mailer/ar_mailer.rb
scambra-ar_mailer-2.1.6 lib/action_mailer/ar_mailer.rb