2017-10-28 5 views
0

メールの設定はsmtpです。修復パスワードを送信しない電子メール

  • すべてが、DEVモードではlocalhostでOK工夫取り組んでいるアクションメールで送信手動メールが

ときプロダクションモードでもokです

  • development.rbでSMTPのconfを使用して、パスワード、電子メールを回復送信、

    のみホストが製造装置内のホストに一致するように変更され

    SMTP confには変わらず、そして手動で送信していますメールは、レールコンソールで

    OKですが、工夫はそれをデバッグする方法

    パスワードのメールを回復し送信しませんか?

    は、実際にはproduction.rbのグローバルメールconfを使用していますか? Devise :: Mailerオーバーライドはありません。 これはイニシャライザのコメントが外されています

  • +0

    ....電子メールを送信するためにいくつかのsmtp APIを使用する必要があるかもしれませんか?ログを確認します。それはあなたに何が起こっているのかという手がかりを与えます。そうすれば、修正を見つけるのは簡単です。 –

    +0

    、リカバリパスワードはProductionでのみ送信されますか?あなたは確かですか、あなたは正しく生産をテストしませんでしたか? –

    答えて

    0

    あなたのプロジェクトのgithubページを共有してください。次に、本番サーバーのログも共有します。 heroku logsで回復できます。私は私のアプリのためにこれを設定した、結局それは壊れた。それは少し難しいです。私はいくつかのガイドに従った。あなたが同じ引用をしたならば、あなたが従ったガイド。私はこのガイドに従って、私は自分のアプリケーションからGmailアカウントの使用を設定する私のGmailアカウントを許可しなければならなかったことを覚えています。

    Setting Up Production Environment

    Now you will need to edit the file “config/environments/production.rb”. We will be adding very similar things to this file. First you can add:

    config.action_mailer.default_url_options = { :host => 'yoursite.herokuapp.com' } 
    

    NOTE: You may also need to add this line. When I was setting up the mailer, I did not find this line in any other tutorials. I had the development mailer working, however I could not get heroku to work. I received this error in the heroku logs:

    ActionView::Template::Error: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true 
    
    :その後、私は guideを引用しています、あなたが production.rbで行う必要があるいくつかの設定があり、完全なガイドを参照してくださいし、オンラインにも他のガイドをチェックするためにそのリンクにアクセスしてください

    I found the answer here: ActionView::Template::Error: Missing host to link to on stackoverflow. If you come across this, then add:

    Rails.application.routes.default_url_options[:host] = 'yoursite.herokuapp.com' 
    

    to your production.rb file.

    Next you will have to add in these lines. Once again make sure that you leave the variables as they are.

    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 = { 
    address: "smtp.gmail.com", 
    port: 587, 
    domain: ENV["GMAIL_DOMAIN"], 
    authentication: "plain", 
    enable_starttls_auto: true, 
    user_name: ENV["GMAIL_USERNAME"], 
    password: ENV["GMAIL_PASSWORD"] 
    } 
    

    これを設定するには、この記事のコメントや他のすべての関連のガイドを読んで、あなたはどのようにあなたがメールを送信している

    関連する問題