Sha256: 7b5b5fd0e96f2268f7fb37122b308d699ea5d924dd9fa358170ab3d6ff7e8ea9

Contents?: true

Size: 1.46 KB

Versions: 5

Compression:

Stored size: 1.46 KB

Contents

module ArMailerRails3
  # A delivery method implementation which sends via sendmail.
  # 
  # To use this, first find out where the sendmail binary is on your computer,
  # if you are on a mac or unix box, it is usually in /usr/sbin/sendmail, this will
  # be your sendmail location.
  # 
  #   Mail.defaults do
  #     delivery_method :sendmail
  #   end
  # 
  # Or if your sendmail binary is not at '/usr/sbin/sendmail'
  # 
  #   Mail.defaults do
  #     delivery_method :sendmail, :location => '/absolute/path/to/your/sendmail'
  #   end
  # 
  # Then just deliver the email as normal:
  # 
  #   Mail.deliver do
  #     to 'mikel@test.lindsaar.net'
  #     from 'ada@test.lindsaar.net'
  #     subject 'testing sendmail'
  #     body 'testing sendmail'
  #   end
  # 
  # Or by calling deliver on a Mail message
  # 
  #   mail = Mail.new do
  #     to 'mikel@test.lindsaar.net'
  #     from 'ada@test.lindsaar.net'
  #     subject 'testing sendmail'
  #     body 'testing sendmail'
  #   end
  # 
  #   mail.deliver!
  class ActiveRecord
    
    def initialize(options)
      self.email_class = options[:email_class] || Email
    end
    
    attr_accessor :email_class_name, :email_class
    
    def deliver!(mail)
      destinations = mail.destinations
      sender = mail.return_path || mail.sender || mail.from_addrs.first
      destinations.each do |destination|
        self.email_class.create :mail => mail.encoded, :to => destination, :from => sender
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ar_mailer_rails3-2.1.12 lib/ar_mailer_rails3/active_record.rb
ar_mailer_rails3-2.1.11 lib/ar_mailer_rails3/active_record.rb
ar_mailer_rails3-2.1.10 lib/ar_mailer_rails3/active_record.rb
ar_mailer_rails3-2.1.9 lib/ar_mailer_rails3/active_record.rb
ar_mailer_rails3-2.1.8 lib/ar_mailer_rails3/active_record.rb