Saturday, 9 April 2016

Action Mailer Configuration and Fix bugs in Rails

Hello All,

Now We are going to a short tutorial on SMTP configuration.

Development Environment:

Add Below Code in config/environments/development.rb



config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.perform_deliveries = true
  ActionMailer::Base.raise_delivery_errors = true
  config.action_mailer.smtp_settings = {
      :address              => "smtp.gmail.com",
      :port                 => 587,
      :domain               => "gmail.com",
      :user_name            => "username@gmail.com",
      :password             => "password",
      :authentication       => :plain,
      :enable_starttls_auto => true
  }
  config.action_mailer.raise_delivery_errors = true



If You get below error so please follow instructions to solve the same.



Visit https://www.google.com/settings/security/lesssecureapps



change
Access for less secure apps

No comments:

Post a Comment