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'

Pony.mail(
  to: 'info@example.com',
  from: 'info@example.net',
  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.