Created
July 14, 2011 19:02
-
-
Save revathskumar/1083170 to your computer and use it in GitHub Desktop.
mailer on ruby
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
require 'rubygems' | |
require 'net/smtp' | |
def sendMail | |
from = 'from@example.com' | |
to = 'to@example.in' | |
message = <<MESSAGE | |
From: Name of the Sender <#{from}> | |
To: Name of the recepient <#{to}> | |
MIME-Version: 1.0 | |
Content-type: text/html | |
Subject: testing my SMTP script | |
MESSAGE | |
Net::SMTP.start('localhost',25) do |smtp| | |
smtp.send_message [message, "testing my script"].join("\r\n"),from,to | |
end | |
end | |
sendMail |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment