DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world
Simple "Send Email From Ruby" Method
By Ian Purton and found at <a href="http://jiploo.com/blog/simple-email-send-function-in-ruby/">http://jiploo.com/blog/simple-email-send-function-in-ruby/</a>
def send_email(from, from_alias, to, to_alias, subject, message)
msg = <<END_OF_MESSAGE
From: #{from_alias} <#{from}>
To: #{to_alias} <#{to}>
Subject: #{subject}
#{message}
END_OF_MESSAGE
Net::SMTP.start('localhost') do |smtp|
smtp.send_message msg, from, to
end
end






Comments
Snippets Manager replied on Fri, 2010/01/29 - 4:13am