Skip to content

Instantly share code, notes, and snippets.

@revathskumar
Created July 14, 2011 19:02
Show Gist options
  • Save revathskumar/1083170 to your computer and use it in GitHub Desktop.
Save revathskumar/1083170 to your computer and use it in GitHub Desktop.
mailer on ruby
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