ActionMailer not sending mail in development Rails 4

后端 未结 5 2089
野趣味
野趣味 2020-12-02 16:58

Why is this mailer not sending any mail? (Or any ideas for debugging?)

In my_app/config/environments/development.rb I have this code:

  config.action         


        
5条回答
  •  孤街浪徒
    2020-12-02 17:29

    So I've figured it out. Having the line ActionMailer::Base.delivery_method = :smtp in config/environment.rb overrides ActionMailer::Base.delivery_method = :test in config/environments/test.rb.

    So, delete that line, ActionMailer::Base.delivery_method = :smtp from config/environment.rb and place it in config/environments/production.rb. That allows you to place ActionMailer::Base.delivery_method = :test in config/environments/test.rb and the version you want in config/environments/development.rb. I made development.rb :test as I populated my database using Faker and changed it to :smtp so I was sure that real emails were sent as an additional check.

    Note: You must restart your server for these changes to take effect.

    Another note: Heroku's current SendGrid Instructions (https://devcenter.heroku.com/articles/sendgrid) put the SendGrid Heroku configuration code in a new config/initializers/mail.rb file which will likely require removing its last line and placing the desired version in each config/environments/[production.rb, development.rb, test.rb]

提交回复
热议问题