Skip to content

Instantly share code, notes, and snippets.

@bjhaid
Created October 30, 2011 18:05
Show Gist options
  • Save bjhaid/1326197 to your computer and use it in GitHub Desktop.
Save bjhaid/1326197 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'net/smtp'
def send_email(from, from_alias, to, to_alias, subject, message)
msg = <<END_OF_MESSAGE
From: #{from_alias} <#{from}>
To: #{to_alias} <#{to}>
Subject: #{subject}
#{message}
END_OF_MESSAGE
Net::SMTP.start('smtp.gmail.com', 587, 'smtp.gmail.com', '[email protected]', 'password', :plain) do |smtp|
smtp.send_message msg, from, to
end
end
send_email('[email protected]', 'ayo', '[email protected]', 'a', 'a', 'a')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment