Skip to content

Instantly share code, notes, and snippets.

@timhugh
Last active March 24, 2017 18:59
Show Gist options
  • Save timhugh/69a28ba67d4cc7e6c220 to your computer and use it in GitHub Desktop.
Save timhugh/69a28ba67d4cc7e6c220 to your computer and use it in GitHub Desktop.
sending mail through gmail using net/smtp
require 'net/smtp'
msg = "Subject: Hi There!\n\nThis works, and this part is in the body."
smtp = Net::SMTP.new 'smtp.gmail.com', 587
smtp.enable_starttls
smtp.start(your_domain, your_account_name, your_password, :login) do
smtp.send_message(msg, from_address, to_address)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment