How to send an email confirmation using gmail smtp to register using development in development mode locally?

I have an application, it uses the application to send confirmation letters to newly registered users, I have smtp parameters in the development.rb file as

  config.action_mailer.default_url_options = { :host => 'http://localhost:3000' }
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
  :enable_starttls_auto => true,
  :address => "smtp.gmail.com",
  :port => 587,
  :domain => "gmail.com",
  :authentication => :login,
  :user_name => "my_username@gmail.com",
  :password => "mygmail password"
    }

It throws me a mistake like

Net::SMTPAuthenticationError in Devise::RegistrationsController#create

535-5.7.1 Please log in with your web browser and then try again. Learn more at

Any ideas how to solve this problem?

Allowed to use these settings ..

 config.action_mailer.default_url_options = { :host => 'localhost:3000' }
 config.action_mailer.perform_deliveries = true
 config.action_mailer.default :charset => "utf-8"
  ActionMailer::Base.smtp_settings = {
  :address              => "smtp.gmail.com",
  :port                 => 587,
  :user_name            => "my_username@gmail.com",
  :password             => 'my_gmail password',
  :authentication       => "plain",
  :enable_starttls_auto => true
  }
+3
source share
3 answers

I was not able to solve this problem with any code. After a while I logged into my gmail account, and this is what it gave me after.

We've detected suspicious activity on your Google Account. Please create a new password to continue using your account.

Read some tips on creating a secure password. 

, - , ,

+3

: authentication = > 'plain'

+1

# ActionMailer Config

config.action_mailer.default_url_options = {:host => 'localhost:3000' }
config.action_mailer.delivery_method = :smtp
# change to false to prevent email from being sent during development
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default :charset => "utf-8"

config.action_mailer.smtp_settings = {
  address: "smtp.gmail.com",
  port: 587,
  domain: "example.com",
  authentication: "plain",
  enable_starttls_auto: true,
  user_name: "your_mail@gmail.com",
  password: "your_password"
}

After creating the development.rb file like this, then if you have problems log in to your gmail account which is used in the development.rb file. Then the problem will be solved.

0
source

All Articles