2011-04-22 65 views
3

我已經在我的環境/ development.rb的ActionMailer Rails的:無法發送電子郵件

config.action_mailer.raise_delivery_errors = true; 
config.action_mailer.delivery_method = :smtp; 
config.action_mailer.smtp_settings = { 
    :address => "smtp.gmail.com", 
    :port => 587, 
    :user_name => "[email protected]", 
    :password => "secret", 
    :authentication => :plain, 
    :enable_starttls_auto => true, 
    :domain => "localhost", 
} 

下面的代碼正在被調用郵件模型生成從我的控制器之一 的電子郵件。但是,我無法在Gmail上發送或接收任何 電子郵件。

我在紅寶石1.8.7,導軌2.3.5。 沒有例外,只是在實際的郵件服務器之間沒有電子郵件被交換 。

對於郵寄者來說,這是一個相當新的事物,對於任何新秀問題都很抱歉。

類似的查詢: Actionmailer not working in rails 2.3

感謝

回答

1

上面你的代碼,你需要把這些行強制性的認證:

require 'tlsmail' 
Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE) 

您還需要tlsmail寶石。

如果它不起作用,您可以嘗試從您的設置中刪除域密鑰。