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