Skip to content

Instantly share code, notes, and snippets.

@tripolitrax
Created August 27, 2015 08:31
Show Gist options
  • Save tripolitrax/0cdbb1ef089176713fbf to your computer and use it in GitHub Desktop.
Save tripolitrax/0cdbb1ef089176713fbf to your computer and use it in GitHub Desktop.
require 'net/smtp'
def send_email(subj, message, supportMail="mail@address1; mail@address2")
supportMail = ENV['SUPPORT'] unless ENV['SUPPORT'] == nil
message = "From: Validation <root@#{Socket.gethostname}>
To: ${supportMail}
Content-type: text/html
Subject: #{subj}
Date: #{Time.now}
#{message}"
Net::SMTP.start("127.0.0.1", 25) do |smtp|
smtp.send_message message, "root@#{Socket.gethostname}",
"#{supportMail}"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment