Probably the easiest way to send email with Ruby is to use the Pony gem.

Here’s a short example:

$ gem install pony
#!/usr/bin/env ruby

require 'rubygems'
require 'pony'

  to: '',
  from: '',
  subject: 'Hello World',
  body: 'This is the message body.'

exit 0

Pony uses local sendmail if available, otherwise it uses SMTP to localhost. You can override this behavior using a via argument.