Skip to content

Instantly share code, notes, and snippets.

@avanathan
Last active January 29, 2019 23:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save avanathan/4d063b76d507428f3f978f861453d08c to your computer and use it in GitHub Desktop.
Save avanathan/4d063b76d507428f3f978f861453d08c to your computer and use it in GitHub Desktop.
Ruby: Send Email with STARTTLS
msgstr = <<END_OF_MESSAGE
From: Your Name <from@email.domain>
To: Destination Address <to@email.domain>
Subject: test message
Date: Sat, 19 Jan 2019 16:26:43 +0900
Message-Id: blah123
This is a test message. Now I can use your email address to send emails..yay!!!
END_OF_MESSAGE
require 'net/smtp'
require 'rubygems'
require 'tlsmail'
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start('email-smtp.us-west-2.amazonaws.com', 25, 'intuit.com',
'<your-user-id>', '<password>', :plain) do |smtp|
smtp.send_message msgstr,
'<from@email.domain>',
'<to@email.domain>'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment