Sending mail with devise and Gmail smtp server

拈花ヽ惹草 提交于 2019-11-28 16:25:14

If you're still having problems with this try using these settings:

require 'tlsmail'    
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)

ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.smtp_settings = {
  :enable_starttls_auto => true,  
  :address            => 'smtp.gmail.com',
  :port               => 587,
  :tls                  => true,
  :domain             => 'gmail.com', #you can also use google.com
  :authentication     => :plain,
  :user_name          => 'jatinkumar.nitk@gmail.com',
  :password           => '_secret_password'
}

Additionally I would recommend putting these settings in your config/environments/development.rb file instead of environment.rb so that you can specify different mailservers for each environment.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!