2012-06-13 31 views
2

我正在Windows 7(64位)上使用ROR開發網站。我正在嘗試設置我的網站,以便在其上創建新登錄的人員收到確認電子郵件。我正在使用ActionMailer發送電子郵件確認。我正在嘗試將其配置爲使用Gmail SMTP服務器發送確認電子郵件。 (這僅僅是測試一旦它的作品,我可以用別的東西的部署服務器。)在ROR上使用ActionMailer發送電子郵件確認時出錯

我收到此錯誤:

Application-specific password required 

下面是從development.rb代碼片段:

 config.action_mailer.raise_delivery_errors = true 
     config.action_mailer.delivery_method = :smtp 

     # these options are only needed if you choose smtp delivery 
     config.action_mailer.smtp_settings = { 
     :address  => 'smtp.gmail.com', 
     :port   => 587, 
     :domain   => 'gmail.com', 
     :authentication => :login, 
     :user_name  => '[email protected]', 
     :password  => 'my_application_specific_password' 
     } 

爲什麼我得到這個錯誤,即使我爲此生成了一個新的應用程序專用密碼並且正在使用它?如何解決這個問題?

+0

你的問題看起來很類似: http://stackoverflow.com/questions/10991932/sending-confirmation-emails-to-registered-users-in-ror-app-via-localhost/10994387#10994387 –

回答

5

我想您可能已經在您用來發送電子郵件的Google帳戶中啓用了額外的兩步安全功能。這可能要求您使用通過短信發送到手機的特殊代碼登錄;或針對特定的不兼容應用程序,創建「應用程序專用密碼」。

有關應用程序專用密碼here的更多詳細信息。

+0

謝謝Rob!我在我的Google帳戶中啓用了雙重身份驗證。但是,我已經生成了應用程序特定的密碼,這正是我在上面的配置中使用的。任何想法還有什麼可能會出錯? – Oatmeal

+1

嗯......你是否嘗試將':authentication =>:login'更改爲':authentication =>:plain'? –