0

I am migrating an ROR3 application to ROR4. And I am very new to this and I am learning along with the migration. I got stuck in the first step it self I am getting an error

Net::SMTPAuthenticationError in ClientsController#create
534-5.7.14 <https://accounts.google.com/ContinueSignIn?sarp=1&scc=1&plt=AKgnsbtq6

Here is my configuration in development.rb.

config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }

  ActionMailer::Base.smtp_settings = {
          :address              => "smtp.gmail.com",
          :port                 => 587,
          :domain               => "gmail.com",
          :user_name            => Rails.application.secrets.email_address,
          :password             => Rails.application.secrets.email_password,
          :authentication       => "plain",
          :enable_starttls_auto => true }

The place where I am getting the error is at

@client.save.

 Apartment::Tenant.create(@client.subdomain)
      Apartment::Tenant.switch(@client.subdomain)
      @client.save
      redirect_to new_user_session_url(subdomain: @client.subdomain)
    else
      render action: 'new'

Can anyone help who is working on ROR?

2 Answers2

2

I had this same issue, be sure to take a look at your gmail account security settings and enable "Access for less secure apps" from www.google.com/settings/security."

Roman Kiselenko
  • 43,210
  • 9
  • 91
  • 103
1

Try this

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
     :address => "smtp.gmail.com",
     :port => 587,
     :user_name => "your mail",
     :password => "your password",
     :authentication => :plain,
     :enable_starttls_auto => true
}
Sanju B Myh
  • 271
  • 1
  • 15