Nikhil Sharma

Joined

50 Experience
0 Lessons Completed
0 Questions Solved

Activity

Posted in Rails 4 ActionMailer Issue

I have created a rails app for booking cabs online. I want my app to have the functionality of sending emails to users once their booking is confirmed. For this, I am following Ryan Bates railscasts:

I started with creating a setup_mail.rb file in app/config/initializers, with the following content:

'''
ActionMailer::Base.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => "railscasts.com",
:user_name => "taxibol",
:password => "secret",
:authentication => "plain",
:enable_starttls_auto => true
}
'''
I then generated a mailer named user_mailer and included the following in app/mailers/user_mailer.rb:
'''
class UserMailer < ActionMailer::Base
default :from => "no-reply@taxibol.in"
def registration_confirmation(user)
mail(:to => user.email, :subject => "Registered")
end
end
'''
and the following in app/views/user_mailer/registration_confirmation.text.erb:

Again got the same log trails, but no mail yet