7

以下を設定しました。

----------------------
config/environments/development.rb
----------------------
 29   ActionMailer::Base.delivery_method = :smtp
 30   ActionMailer::Base.perform_deliveries = true
 31   ActionMailer::Base.raise_delivery_errors = true
 32  
 33   ActionMailer::Base.smtp_settings = {
 34     :enable_starttls_auto => true,  #this is the important stuff!
 35     :address        => 'smtp.gmail.com',
 36     :port           => 587,
 37     :domain         => 'foo.com',
 38     :authentication => :plain,
 39     :user_name      => '---@---.---',
 40     :password       => '---'
 41   }

ただし、deviseが確認メールを送信すると、webbrickはエラーなしでログにメールを出力しますが、メールは私の受信トレイまたはスパム受信トレイに届きません。

何か案は?

編集:

I now get

    Net::SMTPAuthenticationError (530 5.7.0 Must issue a STARTTLS command first. x13sm2646038bki.0

):

見つけた

----------------------
config/environments/development.rb
----------------------
 17   # Don't care if the mailer can't send
 18   config.action_mailer.raise_delivery_errors = false

設定ファイルの上位に設定されていました。しかし、STARTTLSコマンドの発行についてこれは何ですか?

解決:

----------------------
config/environments/development.rb
----------------------
 26   require 'tlsmail' #key but not always described
 27   Net::SMTP.enable_tls(OpenSSL::SSL::VERIFY_NONE)
 28  
 29   ActionMailer::Base.delivery_method = :smtp
 30   ActionMailer::Base.perform_deliveries = true
 31   ActionMailer::Base.raise_delivery_errors = true
 32  
 33   ActionMailer::Base.smtp_settings = {
 34     :enable_starttls_auto => true,  #this is the important stuff!
 35     :address        => 'smtp.gmail.com',
 36     :port           => 587,
 37     :domain         => 'xtargets.com',
 38     :authentication => :plain,
 39     :user_name      => '-------',
 40     :password       => '-------'
 41   }
 42  

ブラッド

4

2 に答える 2

5

私もまったく同じ問題を抱えていました。私の場合はバグが原因で(Net :: SMTPはGmailで必要なTLSを話す方法がありません)、ここで説明するように解決しました。

于 2010-09-25T17:18:23.647 に答える
0

SSL証明書の検証をグローバルにオフにするのではなく、smtp_settingsに追加のパラメーターを渡すことができます。

config.action_mailer.smtp_settings = {
  :address              => 'smtp.example.com',
  :port                 => '25',
  :domain               => 'example.com',
  :user_name            => 'someone@example.com',
  :password             => 'secret',
  :authentication       => 'plain',
  :enable_starttls_auto => true,
  :openssl_verify_mode  => OpenSSL::SSL::VERIFY_NONE,
}

require 'openssl'また、その定数を取得する必要がある場合もあります。

ハッシュにPony含める場合、このソリューションは、でも機能します。:openssl_verify_mode:via_options

于 2011-03-26T15:02:45.070 に答える