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