Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

ruby - rails email error - 530-5.5.1 Authentication Required.

trying to send email form Ruby on Rails but getting this:

SocketError in UsersController#create
getaddrinfo: nodename nor servname provided, or not known

My environments/development.rb file has:

  config.action_mailer.smtp_settings = { 
    address: "smtp.gmail.com",
    port: 587,
    domain: "my_company.org",
    authentication: "plain",
    enable_starttls_auto: true,
    user_name: "my_username@my_company.org",
    password: "my_pass"
  }

and

  config.action_mailer.delivery_method = :smtp

and

  config.action_mailer.default_url_options = { :host => 'localhost:5000' } 
  # 5000 rather than 3000 as I am using foreman.
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

I did the same using my Gmail, following are my configurations, try and see it if works

  config.action_mailer.default_url_options = { :host => 'localhost:3000' }
  ActionMailer::Base.smtp_settings = {
                    :address        => "smtp.gmail.com",
                    :port           => 587,
                    :authentication => :plain,
                    :user_name      => "<my gmail>@gmail.com",
                    :password       => "<my gmail password>",
                    :openssl_verify_mode  => 'none'
  } 

and please note the

:openssl_verify_mode  => 'none'

section to skip the SSL errors.

But sorry, I have no idea what the error is, probably you try to use the Gmail SMTP server with another domain name.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...