Action Mailer does not send mails at all

62 views
Skip to first unread message

Soichi Ishida

unread,
Feb 26, 2012, 7:56:16 PM2/26/12
to rubyonra...@googlegroups.com
Rails 3.1.3

I have followed the RailsCast ActionMailer.
http://railscasts.com/episodes/206-action-mailer-in-rails-3
Around 5minutes, Ryan succeeds in sending mails, but I don't.


My setup_mail.rb

ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "gmail.com",
:user_name => "souji...@gmail.com",
:password => "xxx",
:authentication => "plain",
:enable_starttls_auto => true
}

I added to users_controller.rb

UserMailer.registration_confirmation(@user).deliver

and user_mailer.rb

class UserMailer < ActionMailer::Base
default from: "fr...@example.com"
def registration_confirmation(user)
mail(:to => user.email, :subject => "Registered" )

end
end

and I prepared registration_confirmation.txt.erb

Could anyone find what's wrong with it ?

Thanks in advance.

soichi

--
Posted via http://www.ruby-forum.com/.

thoen

unread,
Feb 27, 2012, 7:04:59 PM2/27/12
to Ruby on Rails: Talk
What happens when you run the following in the console?

user = User.first
UserMailer.registration_confirmation(user).deliver



On Feb 26, 7:56 pm, Soichi Ishida <li...@ruby-forum.com> wrote:
> Rails 3.1.3
>
> I have followed the RailsCast ActionMailer.http://railscasts.com/episodes/206-action-mailer-in-rails-3
> Around 5minutes, Ryan succeeds in sending mails, but I don't.
>
> My setup_mail.rb
>
> ActionMailer::Base.smtp_settings = {
>   :address              => "smtp.gmail.com",
>   :port                 => 587,
>   :domain               => "gmail.com",
>   :user_name => "soujiro0...@gmail.com",
>   :password => "xxx",
>   :authentication       => "plain",
>   :enable_starttls_auto => true
>
> }
>
> I added to users_controller.rb
>
>         UserMailer.registration_confirmation(@user).deliver
>
> and user_mailer.rb
>
> class UserMailer < ActionMailer::Base
>   default from: "f...@example.com"
Reply all
Reply to author
Forward
0 new messages