2011-12-01 51 views
0

我只是配置电子邮件设置,并尝试在我的应用程序中注册一个新帐户。设计日志发送确认邮件在哪里?

它应该发送确认电子邮件,但没有发生任何事情,并没有显示错误。

我在哪里可以获取日志以查看配置文件中是否存在任何问题?

在development.rb

config.action_mailer.delivery_method = :smtp 
config.action_mailer.smtp_settings = { 
:address    => "smtp.gmail.com", 
:port     => 587, 
:domain    => 'mail.google.com', 
:user_name   => '[email protected]', 
: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   => "[email protected]", 
:password    => "password", 
:domain    => "gmail.com", 
:authentication  => :login } 

回答

1

,如果你已经配置了default_url_options

没有指定
config.action_mailer.default_url_options = { :host => 'example.com' } 

如果您正在测试development和你的日志级别是debug,action_mailer将在日志中显示是这样的:

Sent mail to [email protected] 

From: [email protected] 
To: [email protected] 
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   => '[email protected]', 
     :password    => 'password', 
     :authentication  => 'plain', 
     :enable_starttls_auto => true } 
+0

谢谢。我可以看到你在development.log中说的话。没有错误,但我仍然没有收到邮件。 –

+0

再次验证您的配置。参见编辑。此外,请检查您的gmail帐户中发送的邮件文件夹,看看邮件是否在那里列出。 – dexter

+0

最后,通过以下链接解决它http://yekmer.posterous.com/devise-gmail-smtp-configuration 谢谢很多! –