Ruby on rails 关于设计发送确认电子邮件的日志在哪里?
我只是配置电子邮件设置并尝试在我的应用程序中注册一个新帐户 它应该发送确认电子邮件,但没有发生任何事情,也没有显示任何错误 在哪里可以获取日志以查看配置文件中是否存在任何问题 下面也是我在development.rb中的配置Ruby on rails 关于设计发送确认电子邮件的日志在哪里?,ruby-on-rails,devise,Ruby On Rails,Devise,我只是配置电子邮件设置并尝试在我的应用程序中注册一个新帐户 它应该发送确认电子邮件,但没有发生任何事情,也没有显示任何错误 在哪里可以获取日志以查看配置文件中是否存在任何问题 下面也是我在development.rb中的配置 config.action_mailer.delivery_method = :smtp config.action_mailer.smtp_settings = { :address => "smtp.gmail.com", :port
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:domain => 'mail.google.com',
:user_name => 'account@gmail.com',
:password => 'password',
:authentication => 'plain',
:enable_starttls_auto => true }
编辑,
最新配置如下:
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => 'smtp.gmail.com:587' }
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => "account@gmail.com",
:password => "password",
:domain => "gmail.com",
:authentication => :login }
您没有指定是否配置了
default\u url\u选项
config.action_mailer.default_url_options = { :host => 'example.com' }
如果您在开发
中进行测试,并且您的日志级别为调试
,那么action\u mailer将在日志中显示如下内容:
Sent mail to xxx@gmail.com
From: a@b.com
To: xxx@gmail.com
Subject: You have been registered with example.com
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8
....blah blah blah...
编辑:我看到两个邮件配置之间有太多的变化。所以,把我的贴出来作为参考
config.action_mailer.default_url_options = { :host => 'example.com' }
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:port => 587,
:user_name => 'abc@gmail.com',
:password => 'password',
:authentication => 'plain',
:enable_starttls_auto => true }
谢谢我可以在development.log中看到您所说的。没有错误,但我仍然没有收到邮件。请再次交叉验证您的配置。请参见编辑。此外,检查你的gmail帐户中的sent mails文件夹,看看邮件是否在那里列出。最后,通过跟踪链接来解决它。非常感谢!