【发布时间】:2013-12-09 21:43:41
【问题描述】:
我在 Google 和 stackoverflow 上都找过答案,但都没有。 我正在尝试设置 smtp 电子邮件以在注册后进行用户确认。它在开发中运行良好。即使启用了 MailCatcher,它也会以某种方式绕过它并从我指定的 gmail 发送到正确的电子邮件。
这是 development.rb 中的内容:
config.action_mailer.default_url_options = { :host => 'localhost:3000'}
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {:address => "localhost", :port => 1025}
这是 production.rb 中的内容:
config.action_mailer.default_url_options = {:host => 'myapp.herokuapp.com', :protocol => 'http'} #I've also tried it without ":protocol => 'http'"
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
config.action_mailer.perform_deliveries = true
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:authentication => :plain, # I've also tried :login
:enable_starttls_auto => true, # Also tried tls => true
:user_name => 'myemail@gmail.com',
:password => 'mypassword'
} #I've also tried having the attribute :domain => 'myapp.herokuapp.com',
在 config/initializers/devise.rb 中
config.mailer_sender = 'please-change-me-at-config-initializers-devise@example.com' #It still sends from myemail@gmail.com even with this line uncommented.
我不知道如何将整个 7 页(word 文档)的 heroku 日志粘贴到代码块中,所以我将它们粘贴到了谷歌文档中。
heroku 日志的谷歌文档(我相信我在第 1-2 页强调了它开始出错的部分):
https://docs.google.com/document/d/1G-cCX7T1sPL5XtjyjHRaWmzfaBbWkuTR2edsDmDm1Pc/edit?usp=sharing
我不确定它在哪里可以找到正确的电子邮件以在开发中发送。我还是个新手。
edit:我刚刚发现在添加确认之前注册的用户也无法登录,所以这可能是heroku的用户问题。但在开发过程中一切仍然正常。
非常感谢您的帮助,谢谢!
【问题讨论】:
标签: ruby-on-rails email heroku devise confirmation