2011-08-09 13 views
2

私はレールでメールを送信する初心者です。私は自分のプロジェクトでデベロッパーを実装しましたが、現在、ウェルカムメールやパスワードリセットメールを送信したいと思います。 Deviseビューではどのような変更を行う必要がありますか? エラーは表示されませんが、まだメールは届きません。次のようにRails Deviseはメールを送信します

が、私はこれらのリンクをたどってきたし、最終的に私のdevise.rb、development.rbとproduction.rbファイルは、次のとおりです。

=== === devise.rb

config.mailer_sender = "[email protected]" 

== = development.rb ==

config.action_mailer.raise_delivery_errors = false 

    config.action_dispatch.best_standards_support = :builtin 

    config.active_support.deprecation = :notify 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = false 
    config.action_mailer.raise_delivery_errors = true 

    config.action_mailer.default :charset => "utf-8" 


    config.action_mailer.default_url_options = { :host => 'localhost:3000' } 
    config.active_support.deprecation = :log 

config.action_mailer.smtp_settings ={ 
:enable_starttls_auto => true, 
:address   => 'smtp.gmail.com', 
:port    => 587, 
:tls    => true, 
:domain    => 'gmail.com', 
:authentication  => :plain, 
:user_name   => '[email protected]', 
:password   => 'xxxxxx' 
} 

=====production.rb=== 
config.action_mailer.default_url_options = { :host => 'gmail.com' } 

    config.active_support.deprecation = :notify 
    config.action_mailer.delivery_method = :smtp 
    config.action_mailer.perform_deliveries = true 
config.action_mailer.raise_delivery_errors =false 
config.action_mailer.default :charset => "utf-8" 

    config.action_mailer.smtp_settings = { 
    :enable_starttls_auto => true, 
    :address   => 'smtp.gmail.com', 
    :port    => 587, 
    :tls     => true, 
    :domain    => 'gmail.com', 
    :authentication  => :plain, 
    :user_name   => '[email protected]', 
    :password   => 'xxxxxx' 
} 

答えて

10

このようなraise_delivery_errors = trueを設定してみてください:

config.action_mailer.perform_deliveries = true # Set it to false to disable the email in dev mode 
config.action_mailer.raise_delivery_errors = true 
config.action_mailer.delivery_method = :smtp 
config.action_mailer.default_url_options = { :host => "localhost:3000" } 


ActionMailer::Base.smtp_settings = { 
        :address  => "smtp.gmail.com", 
        :port   => 587, 
        :authentication => :plain, 
        :user_name  => "[email protected]", 
        :password  => "password" 
} 
+0

のthnxでのGmailを使ってメールを送信するためのリンクに従ってください...私は宝石tlsmailなく動作true..itsに「perform_deliveries」を設定する必要がありましたが実現しました... – Shruti

関連する問題