Class: Mail::Exim

Inherits:
Sendmail show all
Includes:
CheckDeliveryParams
Defined in:
lib/mail/network/delivery_methods/exim.rb

Overview

A delivery method implementation which sends via exim.

To use this, first find out where the exim binary is on your computer, if you are on a mac or unix box, it is usually in /usr/sbin/exim, this will be your exim location.

Mail.defaults do
  delivery_method :exim
end

Or if your exim binary is not at ‘/usr/sbin/exim’

Mail.defaults do
  delivery_method :exim, :location => '/absolute/path/to/your/exim'
end

Then just deliver the email as normal:

Mail.deliver do
  to '[email protected]'
  from '[email protected]'
  subject 'testing exim'
  body 'testing exim'
end

Or by calling deliver on a Mail message

mail = Mail.new do
  to '[email protected]'
  from '[email protected]'
  subject 'testing exim'
  body 'testing exim'
end

mail.deliver!

Instance Attribute Summary

Attributes inherited from Sendmail

#settings

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CheckDeliveryParams

included

Methods inherited from Sendmail

#deliver!

Constructor Details

#initialize(values) ⇒ Exim

Returns a new instance of Exim.



43
44
45
46
# File 'lib/mail/network/delivery_methods/exim.rb', line 43

def initialize(values)
  self.settings = { :location       => '/usr/sbin/exim',
                    :arguments      => '-i -t' }.merge(values)
end

Class Method Details

.call(path, arguments, destinations, mail) ⇒ Object



48
49
50
51
52
53
54
# File 'lib/mail/network/delivery_methods/exim.rb', line 48

def self.call(path, arguments, destinations, mail)
  check_params(mail)
  IO.popen("#{path} #{arguments}", "w+") do |io|
    io.puts mail.encoded.to_lf
    io.flush
  end
end