レール-ActionMailer URL dev対prod
-
25-09-2019 - |
質問
ってビルアプリ、すべてのmailersのURL0.0.0.0:3000がたかったのは...
そろそろに押し出されてherokuのUrlなかったのアップデート製品のメーラー。たい設定"を確認してください。◆
/config/環境/製作。rb
config.action_mailer.default_url_options = { :host => 'mynewapp.heroku.com' }
/config/initializers/setup_mail.rb
ActionMailer::Base.smtp_settings = {
:address => "smtp.sendgrid.net",
:port => "25",
:authentication => "plain",
:domain => "xxxxxxx.com",
:user_name => "xxxx@xxxxxx.com",
:password => "xxxxxxxxxxxxx"
}
# The to field is then changed so that the email is sent to
ActionMailer::Base.default_url_options[:host] = "0.0.0.0:3000"
Mail.register_interceptor(DevelopmentMailInterceptor) if Rails.env.development?
いすべてのUrlが0.0.0.0:3000はありますか設定したい設定の時に押しherokuを特定するレールすることで、生産モードになっていますか?はっしゃんしますのでご注意ください。▼
感謝
解決
この行を置きます:
ActionMailer::Base.default_url_options[:host] = "0.0.0.0:3000"
での設定/環境/ development.rb の、そしてまた、の設定/環境/ production.rb のではなく、適切なURLであることを、後者でそれを修正します。
もし初期化子間違っているすべての環境、のためにそれを設定している中で、それを入れてます。
他のヒント
あなたのGemfile
に次の行を追加します:
gem "action_mailer_auto_url_options"
とURLが自動的に正しくマッピングされます。
所属していません StackOverflow