<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -2,8 +2,6 @@ require 'optparse'
 require 'net/smtp'
 require 'smtp_tls' unless Net::SMTP.instance_methods.include?(&quot;enable_starttls_auto&quot;)
 require 'rubygems'
-require 'action_mailer'
-require 'action_mailer/ar_mailer'
 
 ##
 # Hack in RSET
@@ -38,6 +36,8 @@ end
 # * --daemon
 # * --mailq
 
+module ActionMailer; end
+
 class ActionMailer::ARSendmail
 
   ##
@@ -70,10 +70,6 @@ class ActionMailer::ARSendmail
 
   attr_accessor :verbose
  
-  ##
-  # ActiveRecord class that holds emails
-
-  attr_reader :email_class
 
   ##
   # True if only one delivery attempt will be made per call to run
@@ -337,7 +333,6 @@ class ActionMailer::ARSendmail
 
     @batch_size = options[:BatchSize]
     @delay = options[:Delay]
-    @email_class = ActionMailer::Base.email_class
     @once = options[:Once]
     @verbose = options[:Verbose]
     @max_age = options[:MaxAge]
@@ -353,7 +348,7 @@ class ActionMailer::ARSendmail
     return if @max_age == 0
     timeout = Time.now - @max_age
     conditions = ['last_send_attempt &gt; 0 and created_on &lt; ?', timeout]
-    mail = @email_class.destroy_all conditions
+    mail = ActionMailer::Base.email_class.destroy_all conditions
 
     log &quot;expired #{mail.length} emails from the queue&quot;
   end
@@ -432,7 +427,7 @@ class ActionMailer::ARSendmail
   def find_emails
     options = { :conditions =&gt; ['last_send_attempt &lt; ?', Time.now.to_i - 300] }
     options[:limit] = batch_size unless batch_size.nil?
-    mail = @email_class.find :all, options
+    mail = ActionMailer::Base.email_class.find :all, options
 
     log &quot;found #{mail.length} emails to send&quot;
     mail</diff>
      <filename>lib/action_mailer/ar_sendmail.rb</filename>
    </modified>
    <modified>
      <diff>@@ -73,7 +73,6 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
     @sm = ActionMailer::ARSendmail.new
 
     assert_equal 60, @sm.delay
-    assert_equal Email, @sm.email_class
     assert_equal nil, @sm.once
     assert_equal nil, @sm.verbose
     assert_equal nil, @sm.batch_size
@@ -82,19 +81,9 @@ Last send attempt: Thu Aug 10 11:40:05 %s 2006
                                        :Once =&gt; true, :BatchSize =&gt; 1000
 
     assert_equal 75, @sm.delay
-    assert_equal Email, @sm.email_class
     assert_equal true, @sm.once
     assert_equal true, @sm.verbose
     assert_equal 1000, @sm.batch_size
-
-    ActionMailer::Base.email_class = Newsletter
-    @sm = ActionMailer::ARSendmail.new
-
-    assert_equal 60, @sm.delay
-    assert_equal Newsletter, @sm.email_class
-    assert_equal nil, @sm.once
-    assert_equal nil, @sm.verbose
-    assert_equal nil, @sm.batch_size
   end
 
   def test_class_parse_args_batch_size</diff>
      <filename>test/test_arsendmail.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>93df899bc0d4082b797a28ef34a959be44f389a6</id>
    </parent>
  </parents>
  <author>
    <name>Adam Meehan</name>
    <email>adam.meehan@gmail.com</email>
  </author>
  <url>http://github.com/adzap/ar_mailer/commit/b6cf565f173c0e25696681e9fef2bbe3b019278c</url>
  <id>b6cf565f173c0e25696681e9fef2bbe3b019278c</id>
  <committed-date>2009-07-06T01:34:22-07:00</committed-date>
  <authored-date>2009-07-06T01:34:22-07:00</authored-date>
  <message>fix preloading ActionMailer before env by using ActionMailer::Base.email_class
directly in ARSendmail methods</message>
  <tree>91a6e519b1cd69df0d21606ca8e09f82ce973dd4</tree>
  <committer>
    <name>Adam Meehan</name>
    <email>adam.meehan@gmail.com</email>
  </committer>
</commit>
