我正在使用Devise的:confirmable和:recoverable模块来确认用户并允许他恢复密码。一切都进行得很顺利,邮件已经生成并且我可以在服务器日志中看到它,但是之后我遇到了错误,邮件没有被送到邮箱里。 我的environment.rb文件中的SMTP设置为:
require 'tlsmail'
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
ActionMailer::Base.raise_delivery_errors = true
ActionMailer::Base.perform_deliveries = true
ActionMailer::Base.delivery_method = :smtp
ActionMailer::Base.smtp_settings = {
:enable_starttls_auto => true, #this is the important shit!
:address => 'smtp.gmail.com', #'localhost',
:port => 587,
:tls => true,
:domain => 'mail.google.com', # mail.customdomain.com if you use google apps
:authentication => :login,
:user_name => 'jatinkumar.nitk@gmail.com',
:password => '_secret_password'
}
如果 :address 是 'smtp.gmail.com',那么我会得到以下错误:SocketError (getaddrinfo: Name or service not known):
如果我将 :address 设置为 'localhost',那么我会收到以下错误:
Errno::ECONNREFUSED Connection refused - connect(2)
我不知道这个 :address 的含义,对于这些东西我是个新手。运行 uname -a 后,我得到的结果是:
Linux jatin-ubuntu 2.6.32-24-generic #38-Ubuntu SMP Mon Jul 5 09:22:14 UTC 2010 i686 GNU/Linux
我在/etc/hosts文件中的条目如下:
127.0.0.1 localhost
127.0.1.1 jatin-ubuntu
*#74.125.93.109 smtp.gmail.com
#The above entry added by me*
# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts
当我在/etc/hosts文件中取消注释'smtp.gmail.com'地址时,以下错误消息消失了:
SocketError (getaddrinfo: Name or service not known):
现在的错误是:
Errno::ECONNREFUSED Connection refused - connect(2)
我不知道出了什么问题,已经搜索了错误并尝试了一切,但没有任何救援措施。 我安装了'tlsmail' gem和'mail' gem,并且我的应用程序处于开发模式。 请帮助我修复这个错误,这样我就可以愉快地继续我的Rails之旅,如果可能的话,请指导我正确处理这个地址问题,以便我理解其基础知识。 提前致谢
:domain
是可选的,但从文档中并不知道这一点。 - Jared BeckOpenSSL::SSL::SSLErrorй”ҷиҜҜ
пјҢиҝҷжҳҜе”ҜдёҖжңҖз»Ҳи§ЈеҶій—®йўҳзҡ„ж–№жі•пјҒ - Noz