2011-12-01 71 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 謝謝很多! –