require 'action_mailer'
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
   :address   => "smtp.gmail.com",
   :port      => 587,
   :domain    => "rubyplus.com",
   :authentication => :plain,
   :user_name      => "bparanj@rubyplus.com",
   :password       => "password",
   :enable_starttls_auto => true
  }
ActionMailer::Base.view_paths= File.dirname(__FILE__)
class Mailer < ActionMailer::Base
  def daily_email
    @var = "var"
    mail(   :to      => "bparanj@something.com",
            :from    => "bparanj@szy.com",
            :subject => "testing mail") do |format|
                format.text
                format.html
    end
  end
end
email = Mailer.daily_email.deliver_now
puts email
email.deliver
In mailer/daily_email.html.erb and mailer/daily_email.text.erb
this is an html email
 and this is a variable <%= @var %> 
this is a text email
and this is a variable <%= @var %>
 
