Rails 4, how to correctly configure smtp settings (gmail)

后端 未结 5 601
半阙折子戏
半阙折子戏 2020-11-29 22:58

I am trying to create a contact form in Rails 4. I did some digging around here and was able to get most of the stuff to work. (followed @sethfri\'s work here Contact Form M

5条回答
  •  渐次进展
    2020-11-29 23:21

    2020, Rails 6 updated answer:

      config.action_mailer.perform_deliveries = true
      config.action_mailer.raise_delivery_errors = true
      config.action_mailer.perform_caching = false
      config.action_mailer.default_url_options = { host: 'localhost', port: 3000 }
      config.action_mailer.delivery_method = :smtp
      config.action_mailer.smtp_settings = {
        address: "smtp.gmail.com",
        port: 587,
        authentication: "plain",
        enable_starttls_auto: true,
        user_name: "blabla@gmail.com",
        password: "blabla", 
        domain: "smtp.gmail.com",
        openssl_verify_mode: "none",
      }
    

提交回复
热议问题