首页 > 解决方案 > Rails 5 忽略了我在 prod 中的操作邮件配置,需要提示/指针

问题描述

所以,我有我的产品配置。

   config.action_mailer.smtp_settings = {
      address:        "***",
      port:           587,
      user_name:      "***",
      password:       "***",
      authentication: :login,
      enable_starttls_auto: true,
    }

但见。

 Started POST "/api/users/password" for 97.115.88.195 at 2021-05-31 18:36:43 +0000
 Processing by Devise::PasswordsController#create as JSON
 I, [2021-05-31T18:36:43.384843 #1]  INFO -- :    Parameters: {"user"=>{"email"=>"***"}, "password"=>{"user"=>{"email"=>"***"}}}
 D, [2021-05-31T18:36:43.388112 #1] DEBUG -- :    User Load (1.2ms)  SELECT  "users".* FROM "users" WHERE "users"."email" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["email", "***"], ["LIMIT", 1]]
 D, [2021-05-31T18:36:43.389763 #1] DEBUG -- :    User Load (1.0ms)  SELECT  "users".* FROM "users" WHERE "users"."reset_password_token" = $1 ORDER BY "users"."id" ASC LIMIT $2  [["reset_password_token", "***"], ["LIMIT", 1]]
 D, [2021-05-31T18:36:43.390938 #1] DEBUG -- :     (0.9ms)  BEGIN
 D, [2021-05-31T18:36:43.392758 #1] DEBUG -- :    User Update (1.2ms)  UPDATE "users" SET "reset_password_token" = $1, "reset_password_sent_at" = $2, "updated_at" = $3 WHERE "users"."id" = $4  [["reset_password_token", "**"], ["reset_password_sent_at", "2021-05-31 18:36:43.389948"], ["updated_at", "2021-05-31 18:36:43.391122"], ["id", 13]]
 D, [2021-05-31T18:36:43.395241 #1] DEBUG -- :     (2.1ms)  COMMIT
 I, [2021-05-31T18:36:43.396071 #1]  INFO -- :    Rendering devise/mailer/reset_password_instructions.html.erb
 I, [2021-05-31T18:36:43.396178 #1]  INFO -- :    Rendered devise/mailer/reset_password_instructions.html.erb (0.1ms)
 D, [2021-05-31T18:36:43.396513 #1] DEBUG -- :  Devise::Mailer#reset_password_instructions: processed outbound mail in 1.0ms
 I, [2021-05-31T18:36:43.397734 #1]  INFO -- :  Sent mail to *** (1.2ms)
 D, [2021-05-31T18:36:43.397766 #1] DEBUG -- :  Date: Mon, 31 May 2021 18:36:43 +0000
 From: no-reply@***
 Reply-To: no-reply@***
 To: ***
 Message-ID: <60b52cbb60f0f_1e5d833822@ip-172-31-36-253.ec2.internal.mail>
 Subject: Reset password instructions
 Mime-Version: 1.0
 Content-Type: text/html;
  charset=UTF-8
 Content-Transfer-Encoding: 7bit

 <p>Hello ***!</p>

 <p>Someone has requested a link to change your password. You can do this through the link below.</p>

 <p>
 <a href="https://app.***/reset/new_pass?reset_password_token=">Change my password</a>
 </p>

 <p>If you didn't request this, please ignore this email.</p>
 <p>Your password won't change until you access the link above and create a new one.</p>

 
  Completed 500 Internal Server Error in 13ms (ActiveRecord: 6.3ms)
 
  Errno::ECONNREFUSED (Connection refused - connect(2) for "localhost" port 25):
 
  /usr/local/lib/ruby/2.7.0/net/smtp.rb:539:in `initialize'
  /usr/local/lib/ruby/2.7.0/net/smtp.rb:539:in `open'
  /usr/local/lib/ruby/2.7.0/net/smtp.rb:539:in `tcp_socket'
  /usr/local/lib/ruby/2.7.0/net/smtp.rb:549:in `block in do_start'
  /usr/local/lib/ruby/2.7.0/timeout.rb:95:in `block in timeout'
  /usr/local/lib/ruby/2.7.0/timeout.rb:105:in `timeout'
  /usr/local/lib/ruby/2.7.0/net/smtp.rb:548:in `do_start'
  /usr/local/lib/ruby/2.7.0/net/smtp.rb:518:in `start'
  mail (2.7.1) lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
  mail (2.7.1) lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
  mail (2.7.1) lib/mail/message.rb:2159:in `do_delivery'
  mail (2.7.1) lib/mail/message.rb:260:in `block in deliver'
  actionmailer (5.2.4.4) lib/action_mailer/base.rb:560:in `block in deliver_mail'
  activesupport (5.2.4.4) lib/active_support/notifications.rb:168:in `block in instrument'
  activesupport (5.2.4.4) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
  activesupport (5.2.4.4) lib/active_support/notifications.rb:168:in `instrument'
  actionmailer (5.2.4.4) lib/action_mailer/base.rb:558:in `deliver_mail'
  mail (2.7.1) lib/mail/message.rb:260:in `deliver'
  actionmailer (5.2.4.4) lib/action_mailer/message_delivery.rb:114:in `block in deliver_now'
  actionmailer (5.2.4.4) lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
  actionmailer (5.2.4.4) lib/action_mailer/message_delivery.rb:113:in `deliver_now'
  devise (4.5.0) lib/devise/models/authenticatable.rb:200:in `send_devise_notification'
  devise (4.5.0) lib/devise/models/recoverable.rb:99:in `send_reset_password_instructions_notification'
  devise (4.5.0) lib/devise/models/recoverable.rb:52:in `send_reset_password_instructions'
  devise (4.5.0) lib/devise/models/recoverable.rb:136:in `send_reset_password_instructions'
  devise (4.5.0controllers) devise/passwords_controller.rb:15:in `create'
  actionpack (5.2.4.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
  actionpack (5.2.4.4) lib/abstract_controller/base.rb:194:in `process_action'
  actionpack (5.2.4.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
  actionpack (5.2.4.4) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
  activesupport (5.2.4.4) lib/active_support/callbacks.rb:132:in `run_callbacks'
  actionpack (5.2.4.4) lib/abstract_controller/callbacks.rb:41:in `process_action'
  actionpack (5.2.4.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
  actionpack (5.2.4.4) lib/action_controller/metal/instrumentation.rb:34:in `block in process_action'
  activesupport (5.2.4.4) lib/active_support/notifications.rb:168:in `block in instrument'
  activesupport (5.2.4.4) lib/active_support/notifications/instrumenter.rb:23:in `instrument'
  activesupport (5.2.4.4) lib/active_support/notifications.rb:168:in `instrument'
  actionpack (5.2.4.4) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
  actionpack (5.2.4.4) lib/action_controller/metal/params_wrapper.rb:256:in `process_action'
  activerecord (5.2.4.4) lib/active_record/railties/controller_runtime.rb:24:in `process_action'
  actionpack (5.2.4.4) lib/abstract_controller/base.rb:134:in `process'
  actionview (5.2.4.4) lib/action_view/rendering.rb:32:in `process'
  actionpack (5.2.4.4) lib/action_controller/metal.rb:191:in `dispatch'
  actionpack (5.2.4.4) lib/action_controller/metal.rb:252:in `dispatch'
  actionpack (5.2.4.4) lib/action_dispatch/routing/route_set.rb:52:in `dispatch'
  actionpack (5.2.4.4) lib/action_dispatch/routing/route_set.rb:34:in `serve'
  actionpack (5.2.4.4) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
  actionpack (5.2.4.4) lib/action_dispatch/routing/mapper.rb:48:in `serve'
  actionpack (5.2.4.4) lib/action_dispatch/journey/router.rb:52:in `block in serve'
  actionpack (5.2.4.4) lib/action_dispatch/journey/router.rb:35:in `each'
  actionpack (5.2.4.4) lib/action_dispatch/journey/router.rb:35:in `serve'
  actionpack (5.2.4.4) lib/action_dispatch/routing/route_set.rb:840:in `call'
  sentry-rails (4.1.7) lib/sentry/rails/rescued_exception_interceptor.rb:9:in `call'
  warden-jwt_auth (0.5.0) lib/warden/jwt_auth/middleware/token_dispatcher.rb:20:in `call'
  warden-jwt_auth (0.5.0) lib/warden/jwt_auth/middleware/revocation_manager.rb:21:in `call'
  rack (2.2.3) lib/rack/builder.rb:244:in `call'
  warden-jwt_auth (0.5.0) lib/warden/jwt_auth/middleware.rb:23:in `call'
  warden (1.2.8) lib/warden/manager.rb:36:in `block in call'
  warden (1.2.8) lib/warden/manager.rb:34:in `catch'
  warden (1.2.8) lib/warden/manager.rb:34:in `call'
  rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
  rack (2.2.3) lib/rack/etag.rb:27:in `call'
  rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
  rack (2.2.3) lib/rack/head.rb:12:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
  rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
  rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/cookies.rb:670:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (5.2.4.4) lib/active_support/callbacks.rb:98:in `run_callbacks'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/debug_exceptions.rb:61:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
  railties (5.2.4.4) lib/rails/rack/logger.rb:38:in `call_app'
  railties (5.2.4.4) lib/rails/rack/logger.rb:26:in `block in call'
  activesupport (5.2.4.4) lib/active_support/tagged_logging.rb:71:in `block in tagged'
  activesupport (5.2.4.4) lib/active_support/tagged_logging.rb:28:in `tagged'
  activesupport (5.2.4.4) lib/active_support/tagged_logging.rb:71:in `tagged'
  railties (5.2.4.4) lib/rails/rack/logger.rb:26:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
  request_store (1.5.0) lib/request_store/middleware.rb:19:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/request_id.rb:27:in `call'
  rack (2.2.3) lib/rack/method_override.rb:24:in `call'
  rack (2.2.3) lib/rack/runtime.rb:22:in `call'
  activesupport (5.2.4.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
  actionpack (5.2.4.4) lib/action_dispatch/middleware/static.rb:127:in `call'
  rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
  sentry-ruby-core (4.1.6) lib/sentry/rack/capture_exceptions.rb:9:in `call'
  rack-cors (1.0.2) lib/rack/cors.rb:97:in `call'
  railties (5.2.4.4) lib/rails/engine.rb:524:in `call'
  puma (3.12.6) lib/puma/configuration.rb:227:in `call'
  puma (3.12.6) lib/puma/server.rb:706:in `handle_request'
  puma (3.12.6) lib/puma/server.rb:476:in `process_client'
  puma (3.12.6) lib/puma/server.rb:334:in `block in run'
  puma (3.12.6) lib/puma/thread_pool.rb:135:in `block in spawn_thread'
  Started POST "/api/users/password" for 97.115.88.195 at 2021-05-31 18:36:43 +0000
  Processing by Devise::PasswordsController#create as JSON
    Parameters: "password"=>{"user"=>{"email"=>"***"}}}

怎么回事?“本地主机”端口 25)“?!FML 轨道。

我已经检查过 Rails.env 及其产品。

我在这里想念什么?

仅供参考,我正在尝试为此使用 AWS SES。谢谢你的帮助。

标签: ruby-on-railsrubydevise

解决方案


推荐阅读