Guest User

Untitled

a guest
Aug 18th, 2018
257
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. require 'rubygems'
  2. require 'net/smtp'
  3.  
  4. def send_email(from, from_alias, to, to_alias, subject, message)
  5. msg = <<END_OF_MESSAGE
  6. From: #{from_alias} <#{from}>
  7. To: #{to_alias} <#{to}>
  8. Subject: #{subject}
  9.  
  10. #{message}
  11. END_OF_MESSAGE
  12.  
  13. Net::SMTP.start('smtp.gmail.com', 587, 'smtp.gmail.com', 'from@gmail.com', 'password', :plain) do |smtp|
  14. smtp.send_message msg, from, to
  15. end
  16. end
  17.  
  18. send_email('from@gmail.com', 'ayo', 'to@gmail.com', 'a', 'a', 'a')
Add Comment
Please, Sign In to add comment