Skip to content
Create a gist now

Instantly share code, notes, and snippets.

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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.