Created
March 17, 2013 12:55
-
-
Save mtkd/5181375 to your computer and use it in GitHub Desktop.
Simple Ruby SMTP send example
This file contains hidden or 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
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