Method: Mail::Sendmail#deliver!

Defined in:
lib/mail/network/delivery_methods/sendmail.rb

#deliver!(mail) ⇒ Object

[View source]

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/mail/network/delivery_methods/sendmail.rb', line 64

def deliver!(mail)
  envelope = Mail::SmtpEnvelope.new(mail)

  arguments = settings[:arguments]
  if arguments.is_a? String
    return old_deliver(envelope)
  end

  command = [settings[:location]]
  command.concat Array(arguments)
  command.concat [ '-f', envelope.from ] if envelope.from

  if destinations = destinations_for(envelope)
    command.push '--'
    command.concat destinations
  end

  popen(command) do |io|
    io.puts ::Mail::Utilities.binary_unsafe_to_lf(envelope.message)
    io.flush
  end
end