rails 3 actionmailer cannot send email

Posted by lkahtz on Stack Overflow See other posts from Stack Overflow or by lkahtz
Published on 2011-02-26T07:18:24Z Indexed on 2011/02/26 7:25 UTC
Read the original article Hit count: 174

Filed under:
|

I am following Ryan Bates's tutorial on Rails 3 ActionMailer. I generate the mailer in terminal and then establish a setup_mail.rb under config/initializers. I keyed in the following code:

ActionMailer::Base.smtp_settings={
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :domail               => "gmail.com",
  :user_name            => "my_account_at_gmail",
  :password             => "my_password",
  :authentication       => "plain"  ,
  :enable_starttls_auto => true
}

My user_mailer.rb file goes like:

class UserMailer < ActionMailer::Base
  default :from => "[email protected]"

  def registration_confirmation(user)
    mail(:to => user.email,:subject => "registered")
  end
end

I tested in rails console: u=User.first UserMailer.registration_confirmation(u).deliver

it displays:

 #<Mail::Message:2194479560, Multipart: false, Headers: <Date: Sat, 26 Feb 2011 14:42:06 +0800>, <From: [email protected]>, <To: [email protected]>, <Message-ID: <[email protected]>>, <Subject: registered>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>

BUT I never received the email here... Why? How can I solve this? I guess it is some problem on send_mail.rb file..

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about actionmailer