Ask A Question

Notifications

You’re not receiving notifications from this thread.

Rails 4 ActionMailer Issue

Nikhil Sharma asked in Rails

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

Reply
Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 71,933+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.