Sha256: e85e1e345f7ed980b0a2d3ba452ca2510264177d992c423dceac26a5510a787b

Contents?: true

Size: 783 Bytes

Versions: 1

Compression:

Stored size: 783 Bytes

Contents

require 'action_mailer'

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

class ActionMailer::ARMailer < ActionMailer::Base

  def self.inherited(sub)
    logger.warn('The ActionMailer::ARMailer class has been deprecated. Will be removed in version 2.1. Just use ActionMailer::Base.')
  end

end

class ActionMailer::Base

  ##
  # Set the email class for deliveries.
  #
  cattr_accessor :email_class
  self.email_class = Email

  ##
  # 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

1 entries across 1 versions & 1 rubygems

Version Path
adzap-ar_mailer-2.0.1 lib/action_mailer/ar_mailer.rb