Last active
January 29, 2019 23:47
-
-
Save avanathan/4d063b76d507428f3f978f861453d08c to your computer and use it in GitHub Desktop.
Ruby: Send Email with STARTTLS
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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