14

Rails 2.3.2およびRuby 1.8.6を使用して、ローカルホストで開発中の ActionMailer を介して実際に送信する際に問題があります。development.log は、エラーなしで電子メールを「送信」したことを示していますが、電子メールは受信されていません。送受信用に複数のメール アドレスを試し、複数の構成とプラグインを試しましたが、メールを送信できません。どんな助けでも大歓迎です-レールとルビーのさまざまなバージョンのソリューションのバージョンの周りで踊っているように感じ、それを突き止めることができません。コメントをいただければ幸いです。ありがとう!

プラグイン:

  • アクションメーラーオプションのTLS
  • smtp_tls

異なるメール設定:

  ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true, #works in ruby 1.8.7 and above
    :address => 'smtp.gmail.com',
    :port => 587,
    :domain => 'example.com',
    :authentication => :plain,
    :user_name => 'testacct',
    :password => 'secret'
  }

  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :tls => :true,
    :address => 'smtp.gmail.com',
    :port => 587,
    :authentication => :plain,
    :user_name => 'testacct@gmail.com',
    :password => 'secret'
    #:enable_starttls_auto => true # for rails >= 2.2 && ruby >= 1.8.7
  }
  config.action_mailer.perform_deliveries = :true #try to force sending in development 
  config.action_mailer.raise_delivery_errors = :true 
  config.action_mailer.default_charset = "utf-8"

開発ログ:

Sent mail to sa23kdj@trash2009.com

Date: Fri, 18 Dec 2009 00:27:06 -0800
From: Test Email Acct <testacct@gmail.com>
To: sa23kdj@trash2009.com
Subject: Signup
Mime-Version: 1.0
Content-Type: multipart/alternative; boundary=mimepart_4b2b3cda9088_634334302a5b7


--mimepart_4b2b3cda9088_634334302a5b7
Content-Type: text/html; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://ww=
w.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang=3D'en' xml:lang=3D'en' xmlns=3D'http://www.w3.org/1999/xhtml'>=

  <head>
    <meta content=3D'text/html;charset=3DUTF-8' http-equiv=3D'content-typ=
e' />
  </head>
  <body>
    Welcome Email
    <p>
      user name:
      lfglkdfgklsdf
      activation link:
      http://localhost:3000/login
    </p>
  </body>
</html>

--mimepart_4b2b3cda9088_634334302a5b7--
4

3 に答える 3

14

以下を入れますconfig/environments/development.rb

config.action_mailer.perform_deliveries = true 
config.action_mailer.raise_delivery_errors = true

の設定を上書きします。config/environment.rb

また、レールの2.X場合は、セットアップする必要があります:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :enable_starttls_auto => true,  
  :address        => "smtp.gmail.com",
  :port           => 587,
  :domain         => "domain.com",
  :user_name      => "username@domain.com",
  :password       => "secret_passsword",
  :authentication => :plain
}
于 2010-12-26T03:21:13.100 に答える
8

trueではなく、 を使用する必要があります:true

:tls => true
...
config.action_mailer.perform_deliveries = true #try to force sending in development 
config.action_mailer.raise_delivery_errors = true 
于 2009-12-18T16:09:52.283 に答える
4

この問題に直面した場合は、環境フォルダーの development.rb で「config.action_mailer.raise_delivery_errors = true」を設定し、メールの送信を再試行してください。これにより、発生したエラーが発生するはずです。

smtp_tls.rb の 8 行目で、check_auth_args メソッドが user と secret の 2 つの引数しか受け付けないことがあります。「authtype」引数が表示されている場合は削除して、再試行してください。動作するはずです。

于 2010-06-29T10:50:27.237 に答える