Skip to content

Instantly share code, notes, and snippets.

@mtkd
Created March 17, 2013 12:55
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 mtkd/5181375 to your computer and use it in GitHub Desktop.
Save mtkd/5181375 to your computer and use it in GitHub Desktop.
Simple Ruby SMTP send example
require 'net/smtp'
message = <<MESSAGE_END
From: Sender <name@sender_domain.com>
To: Receiver <name@receiver_domain.com>
Subject: SMTP e-mail test
This is a test e-mail message.
MESSAGE_END
Net::SMTP.start('mail.smtp.com', 25, 'mail.smtp.com', 'username', 'password', :login) do |smtp|
smtp.send_message message, 'name@sender_domain.com',
'name@sender_domain.com'
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment