2012-07-30 44 views
2

尝试发送on Rails的电子邮件的形式Ruby,但得到这个:rails邮件错误 - 530-5.5.1需要验证。

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

我的环境/ development.rb文件有:

config.action_mailer.smtp_settings = { 
    address: "smtp.gmail.com", 
    port: 587, 
    domain: "my_company.org", 
    authentication: "plain", 
    enable_starttls_auto: true, 
    user_name: "[email protected]_company.org", 
    password: "my_pass" 
    } 

config.action_mailer.delivery_method = :smtp 

config.action_mailer.default_url_options = { :host => 'localhost:5000' } 
    # 5000 rather than 3000 as I am using foreman. 
+0

我有同样的'530-5.5.1',但.. facepalm ..我的user_name是空白的。所以这是首先要检查的东西! – 2013-03-27 05:45:06

回答

8

我用我的Gmail也一样,下面是我的配置,尝试,看看它是否工作

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' 
    } 

,并请注意

:openssl_verify_mode => 'none' 

部分跳过SSL错误

不过比较遗憾,我不知道错误是什么,可能你尝试使用另一个域名的Gmail邮件服务器

HTH

欢呼声

+0

看起来像openssl_verify_mode做的伎俩! – 2012-07-30 16:49:23

+1

现在我得到一个Net :: OpenTimeout错误。 – mikeglaz 2014-04-14 19:27:54

+0

@MichaelGlaz,检查了这一点,这可能有助于:) http://stackoverflow.com/questions/16040158/rails-mailer-netopentimeout-execution-expired-exception-on-production-serve – sameera207 2014-04-14 22:48:27