secret
Created

  • Download Gist
gistfile1.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
require 'net/smtp'
def sendEmail(to, subject, message)
to=to.to_s()
to.gsub!(" ","")
to.gsub!(";",",")
smtp = Net::SMTP.new('smtp.gmail.com', 587)
smtp.enable_starttls
smtp.start("smtp.gmail.com","myemail@gmail.com","password",:login)
to.split(",").each {|email|
emailMessage = "From: myemail <myemail@gmail.com>
To: <#{email.to_s()}>
Subject: #{subject.to_s()}
Content-Type: text/html;
#{message.to_s()}
"
smtp.send_message(emailMessage.to_s(),"myemail@gmail.com", email.to_s())
}
end
 
t = Thread.new do
sendEmail("myemail@gmail.com","mysubject","mybody")
end
while(t.alive?)
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.