Skip to content

Instantly share code, notes, and snippets.

@augustl
Created October 19, 2008 00:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save augustl/17755 to your computer and use it in GitHub Desktop.
Save augustl/17755 to your computer and use it in GitHub Desktop.
# Requires /usr/sbin/sendmail (e.g. postfix)
module Mailer
def self.deliver(to, subject, body)
IO.popen("/usr/sbin/sendmail #{to}", 'w+') do |sendmail|
sendmail.puts "Subject: #{subject}"
sendmail.puts "From: Your Name <foo@yourname.com>"
sendmail.puts "To: #{to}"
sendmail.puts body
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment