I am following the Ryan Bates tutorial on Rails 3 ActionMailer . I create a mailbox in the terminal and then set setup_mail.rb in config / initializers. I entered 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
}
The user_mailer.rb file is as follows:
class UserMailer < ActionMailer::Base
default :from => "my_account_at_gmail@gmail.com"
def registration_confirmation(user)
mail(:to => user.email,:subject => "registered")
end
end
I tested in the rails console: and = User.first UserMailer.registration_confirmation (s) Deliver
it displays:
#<Mail::Message:2194479560, Multipart: false, Headers: <Date: Sat, 26 Feb 2011 14:42:06 +0800>, <From: my_account_at_gmail@gmail.com>, <To: some_account@gmail.com>, <Message-ID: <some_number@My-MacBook-Pro.local.mail>>, <Subject: registered>, <Mime-Version: 1.0>, <Content-Type: text/plain>, <Content-Transfer-Encoding: 7bit>>
BUT I never got an email here ... Why? How can i solve this? I think this is a problem in the send_mail.rb file.
source
share