Class: Mail::Sendmail

Inherits:
Object
  • Object
show all
Defined in:
lib/jpmobile/mail.rb

Class Method Summary collapse

Class Method Details

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


615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
# File 'lib/jpmobile/mail.rb', line 615

def Sendmail.call(path, arguments, destinations, mail)
  if mail.respond_to?(:encoded)
    encoded_mail = mail.encoded
  else
    encoded_mail = mail
  end
  if Jpmobile::Util.jis?(encoded_mail)
    encoded_mail = Jpmobile::Util.ascii_8bit(encoded_mail)
  end

  IO.popen("#{path} #{arguments} #{destinations}", "w+") do |io|
    io.puts encoded_mail.gsub(/\r\r\n/, "\n").to_lf
    io.flush
  end
end