Skip to content

Instantly share code, notes, and snippets.

@dpwright
Created April 16, 2012 00:57
Show Gist options
  • Save dpwright/2395670 to your computer and use it in GitHub Desktop.
Save dpwright/2395670 to your computer and use it in GitHub Desktop.
Sending email with Ruby + Google Apps Mail
#!/usr/bin/env ruby
require 'rubygems'
require 'tlsmail'
msg=<<EOF
From: Test Sender <[email protected]>
To: Test Recipient <[email protected]>
Subject: test
This is a test
EOF
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
Net::SMTP.start('smtp.gmail.com', 587, 'domain.com', '[email protected]', 'password', :login) do |smtp|
smtp.send_message msg, "[email protected]", "[email protected]"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment