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!
# File lib/mail/network/delivery_methods/sendmail.rb, line 55
55: def Sendmail.call(path, arguments, destinations, mail)
56: IO.popen("#{path} #{arguments} #{destinations}", "w+") do |io|
57: io.puts mail.encoded.to_lf
58: io.flush
59: end
60: end
# File lib/mail/network/delivery_methods/sendmail.rb, line 46
46: def deliver!(mail)
47: envelope_from = mail.return_path || mail.sender || mail.from_addrs.first
48: return_path = "-f \"#{envelope_from}\"" if envelope_from
49:
50: arguments = [settings[:arguments], return_path].compact.join(" ")
51:
52: Sendmail.call(settings[:location], arguments, mail.destinations.join(" "), mail)
53: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.