getting the action mailer recipe to actually work, no thanks to default setup not playing nice with local postfix :-/

This commit is contained in:
Dan Buch 2011-08-08 07:13:37 -04:00
parent 5de7f2bd3a
commit 4bad1c5bdd

View File

@ -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