module Sendmail

Attributes

args[RW]
bin[RW]

Public Class Methods

sendmail!(mail, opts = {}) click to toggle source
# File lib/sendmail.rb, line 14
def sendmail!(mail, opts = {})
  bin     = opts[:bin]  || Sendmail.bin
  args    = opts[:args] || Sendmail.args
  command = [bin, args]
  command << opts[:to] if opts.key?(:to)
  
  io = IO.popen(command, "w+b")
  io.write(mail)
  io.close
  $?.to_i == 0
end

Private Instance Methods

sendmail!(mail, opts = {}) click to toggle source
# File lib/sendmail.rb, line 14
def sendmail!(mail, opts = {})
  bin     = opts[:bin]  || Sendmail.bin
  args    = opts[:args] || Sendmail.args
  command = [bin, args]
  command << opts[:to] if opts.key?(:to)
  
  io = IO.popen(command, "w+b")
  io.write(mail)
  io.close
  $?.to_i == 0
end