gmail smtp with rails 3

后端 未结 4 1745
情深已故
情深已故 2020-12-05 02:38

I am trying to get a confirmation email sending using a gmail account. I have looked around and there is nothing that is obvious. There is no errors or anything, it just dos

4条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-05 03:10

    add tlsmail to gemfile

    gem 'tlsmail'
    

    run :

    bundle install
    

    add these settings to config/envirnoments/development.rb file

    YourApplicationName::Application.configure do
        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 = {
              :address => "smtp.gmail.com",
              :port => "587",
              :domain => "gmail.com",
              :enable_starttls_auto => true,
              :authentication => :login,
              :user_name => "@gmail.com",
              :password => ""
          }
    
        config.action_mailer.raise_delivery_errors = true
    

提交回复
热议问题