You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

29 lines
678 B

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