我已经设置了以下内容。
----------------------
config/environments/development.rb
----------------------
29 ActionMailer::Base.delivery_method = :smtp
30 ActionMailer::Base.perform_deliveries = true
31 ActionMailer::Base.raise_delivery_errors = true
32
33 ActionMailer::Base.smtp_settings = {
34 :enable_starttls_auto => true, #this is the important stuff!
35 :address => 'smtp.gmail.com',
36 :port => 587,
37 :domain => 'foo.com',
38 :authentication => :plain,
39 :user_name => '---@---.---',
40 :password => '---'
41 }
然而,当设计发送确认电子邮件时,webbrick 会打印出来 日志中的电子邮件没有错误,但电子邮件没有结束 在我的收件箱或垃圾邮件收件箱中。
有什么想法吗?
编辑:
I now get
Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first. x13sm2646038bki.0
):
我发现
----------------------
config/environments/development.rb
----------------------
17 # Don't care if the mailer can't send
18 config.action_mailer.raise_delivery_errors = false
已在配置文件中设置得更高。然而,发出 STARTTLS 命令是什么意思?
解决方案:
----------------------
config/environments/development.rb
----------------------
26 require 'tlsmail' #key but not always described
27 Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
28
29 ActionMailer::Base.delivery_method = :smtp
30 ActionMailer::Base.perform_deliveries = true
31 ActionMailer::Base.raise_delivery_errors = true
32
33 ActionMailer::Base.smtp_settings = {
34 :enable_starttls_auto => true, #this is the important stuff!
35 :address => 'smtp.gmail.com',
36 :port => 587,
37 :domain => 'xtargets.com',
38 :authentication => :plain,
39 :user_name => '-------',
40 :password => '-------'
41 }
42
布拉德
最佳答案
我遇到了同样的问题;在我的例子中是由于一个错误(Net::SMTP 不怎么讲 TLS,这是 gmail 所要求的),我按照解释解决了它 here .
关于ruby-on-rails-3 - 使用 gmail 的 devise on rails3 的确认电子邮件未到达,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3794669/