我正在使用Devise:confirmable和:recoverable模塊來確認用戶,並讓他在忘記密碼時讓他恢復密碼。一切正常,郵件得到生成,我可以在服務器日誌中看到它,但然後我面臨錯誤,郵件沒有傳遞到郵箱。 我的environment.rb文件中的SMTP設置是:用設計和Gmail 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 => '[email protected]',
:password => '_secret_password'
}
如果:地址是 'smtp.gmail.com',然後我得到以下錯誤:
SocketError (getaddrinfo: Name or service not known):
如果我設置:地址爲「本地主機」,然後我得到以下錯誤:
Errno::ECONNREFUSED Connection refused - connect(2)
我不知道這是什麼:地址意味着,所有這些東西是一個新手。 在運行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
當我去掉了 'smtp.gmail.com' 地址在/ etc/hosts文件中,以下錯誤消失:
SocketError (getaddrinfo: Name or service not known):
現在錯誤是:
Errno::ECONNREFUSED Connection refused - connect(2)
我不知道怎麼回事,錯誤地搜索了一下,並嘗試了一切,但沒有什麼來拯救。 我確實已經安裝了'tlsmail' gem並且還有'郵件'寶石,我的應用程序處於開發模式。 幫助我解決這個錯誤,以便我可以愉快地繼續我的鐵路之旅,如果可能的話,引導我一點點:正確的方向地址問題,以便我瞭解這方面的基礎知識。 在此先感謝
謝謝你......真的有用。如果我有自己的域名和該域名的用戶名,您還可以記下設置嗎? – 2010-12-12 17:55:11
只需將域名和用戶名更改爲[email protected] ...其他所有內容都應該相同。 – 2010-12-15 02:38:33
使用此設置,它是否會將電子郵件從[email protected]發送到任何郵寄地址? – shibly 2011-10-09 01:43:05