require 'rubygems' require 'action_mailer' class SimpleMailer < ActionMailer::Base def simple_message(recipient) from 'daniel.buch@gmail.com' recipients recipient subject 'A single-part message for you' body 'This message has a plain text body.' end end puts 'generated message:' puts SimpleMailer.simple_message('daniel.buch+rubytest@gmail.com') ActionMailer::Base.smtp_settings = { :tls => true, :address => 'smtp.gmail.com', :port => "587", :domain => 'gmail.com', :user_name => 'daniel.buch@gmail.com', :password => STDIN.readline } SimpleMailer.simple_message('daniel.buch+rubytest@gmail.com').deliver