Created
March 18, 2009 20:58
-
-
Save adzap/81402 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 | |
class_inheritable_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 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment