...

How To : Send emails via Gmail SMTP in Ruby

Here is a simple ruby code to send emails through Gmail SMTP servers.  This code uses the Mail gem available @ https://github.com/mikel/mail

require 'mail'

options = { 
            :address              => "smtp.gmail.com",
            :port                 => 587,
            :user_name            => '<gmail user name>@gmail.com',
            :password             => '<gmail password>',
            :authentication       => 'plain',
            :enable_starttls_auto => true  
}


Mail.defaults do
  delivery_method :smtp, options
end

Mail.deliver do
       to '<email of receiver>'
     from '<gmail user name>@gmail.com'
  subject 'Subject - Ruby Email via Gmail SMTP'
     body 'sample content sample content sample content '
end

Please do post your queries and suggestions in the comments section below.