rails,设计发送确认电子邮件

时间:2021-01-02 06:05:12

标签: ruby devise

我正在尝试通过模态设置设计注册并使用电子邮件或 Facebook 登录。我想通了,但现在我正在尝试添加确认电子邮件,需要用户在他们登录之前确认他们的电子邮件。它在本地工作,但我无法设置让它在生产中工作。如果在这里提出这个问题并按照答案中的步骤进行操作,但我的模型在我尝试注册时会举手。

How do I set up email confirmation with Devise?

用户正在被添加到数据库中,但是当它到达发送电子邮件部分时,它只会给我一个错误。

这是日志:


the-mat-house | 2021-01-01 22:45:33 D, [2021-01-02T05:45:33.954550 #1] DEBUG -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae]    (1.6ms)  COMMIT
the-mat-house | 2021-01-01 22:45:33 I, [2021-01-02T05:45:33.964848 #1]  INFO -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae]   Rendering devise/mailer/confirmation_instructions.html.erb
the-mat-house | 2021-01-01 22:45:33 I, [2021-01-02T05:45:33.967839 #1]  INFO -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae]   Rendered devise/mailer/confirmation_instructions.html.erb (Duration: 2.6ms | Allocations: 224)
the-mat-house | 2021-01-01 22:45:33 D, [2021-01-02T05:45:33.969026 #1] DEBUG -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae] Devise::Mailer#confirmation_instructions: processed outbound mail in 13.1ms
the-mat-house | 2021-01-01 22:46:03 I, [2021-01-02T05:46:03.977560 #1]  INFO -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae] Delivered mail 5ff0087ded45a_1718449fd@the-mat-house-c478cc659-dkl8z.mail (30008.1ms)
the-mat-house | 2021-01-01 22:46:03 D, [2021-01-02T05:46:03.977988 #1] DEBUG -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae] Date: Sat, 02 Jan 2021 05:45:33 +0000
the-mat-house | 2021-01-01 22:46:03 From: info@themathouse.com
the-mat-house | 2021-01-01 22:46:03 Reply-To: info@themathouse.com
the-mat-house | 2021-01-01 22:46:03 To: scott@allaboutjudo.com
the-mat-house | 2021-01-01 22:46:03 Message-ID: <5ff0087ded45a_1718449fd@the-mat-house-c478cc659-dkl8z.mail>
the-mat-house | 2021-01-01 22:46:03 Subject: Confirmation instructions
the-mat-house | 2021-01-01 22:46:03 Mime-Version: 1.0
the-mat-house | 2021-01-01 22:46:03 Content-Type: text/html;
the-mat-house | 2021-01-01 22:46:03  charset=UTF-8
the-mat-house | 2021-01-01 22:46:03 Content-Transfer-Encoding: 7bit
the-mat-house | 2021-01-01 22:46:03 
the-mat-house | 2021-01-01 22:46:03 <p>Welcome scott@allaboutjudo.com!</p>
the-mat-house | 2021-01-01 22:46:03 
the-mat-house | 2021-01-01 22:46:03 <p>Thank you for registering at TheMatHouse.com.  You've been registered successfully!</p>
the-mat-house | 2021-01-01 22:46:03 <p>Please click on the link below to activate your accouint.</p>
the-mat-house | 2021-01-01 22:46:03 
the-mat-house | 2021-01-01 22:46:03 <p><a href="http://smtpout.secureserver.net/users/confirmation?confirmation_token=4t1cR8GDo9MzB5xPRDcQ">Confirm my account</a></p>
the-mat-house | 2021-01-01 22:46:03 
the-mat-house | 2021-01-01 22:46:03 I, [2021-01-02T05:46:03.980919 #1]  INFO -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae] Completed 500 Internal Server Error in 30441ms (ActiveRecord: 17.6ms | Allocations: 8718)
the-mat-house | 2021-01-01 22:46:03 F, [2021-01-02T05:46:03.990499 #1] FATAL -- : [33aeba17-bc52-4b8c-be9a-76b1bb608cae]   
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] Net::OpenTimeout (execution expired):
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae]   
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/net/smtp.rb:539:in `initialize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/net/smtp.rb:539:in `open'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/net/smtp.rb:539:in `tcp_socket'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/net/smtp.rb:549:in `block in do_start'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/timeout.rb:105:in `timeout'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/net/smtp.rb:548:in `do_start'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] /layers/heroku_ruby/ruby/vendor/ruby-2.7.2/lib/ruby/2.7.0/net/smtp.rb:518:in `start'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] mail (2.7.1) lib/mail/network/delivery_methods/smtp.rb:109:in `start_smtp_session'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] mail (2.7.1) lib/mail/network/delivery_methods/smtp.rb:100:in `deliver!'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] mail (2.7.1) lib/mail/message.rb:2159:in `do_delivery'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] mail (2.7.1) lib/mail/message.rb:260:in `block in deliver'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionmailer (6.0.3.4) lib/action_mailer/base.rb:589:in `block in deliver_mail'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/notifications.rb:180:in `block in instrument'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/notifications.rb:180:in `instrument'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionmailer (6.0.3.4) lib/action_mailer/base.rb:587:in `deliver_mail'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] mail (2.7.1) lib/mail/message.rb:260:in `deliver'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionmailer (6.0.3.4) lib/action_mailer/message_delivery.rb:115:in `block in deliver_now'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionmailer (6.0.3.4) lib/action_mailer/rescuable.rb:17:in `handle_exceptions'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionmailer (6.0.3.4) lib/action_mailer/message_delivery.rb:114:in `deliver_now'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] devise (4.7.3) lib/devise/models/authenticatable.rb:200:in `send_devise_notification'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] devise (4.7.3) lib/devise/models/confirmable.rb:121:in `send_confirmation_instructions'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] devise (4.7.3) lib/devise/models/confirmable.rb:183:in `send_on_create_confirmation_instructions'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:428:in `block in make_lambda'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:263:in `block in conditional'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:517:in `block in invoke_after'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:517:in `each'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:517:in `invoke_after'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:136:in `run_callbacks'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:825:in `_run_commit_callbacks'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/transactions.rb:339:in `committed!'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/transaction.rb:127:in `commit_records'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/transaction.rb:265:in `block in commit_transaction'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/transaction.rb:255:in `commit_transaction'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/transaction.rb:293:in `block in within_new_transaction'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:26:in `block (2 levels) in synchronize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `handle_interrupt'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:25:in `block in synchronize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `handle_interrupt'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/concurrency/load_interlock_aware_monitor.rb:21:in `synchronize'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/transaction.rb:278:in `within_new_transaction'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/connection_adapters/abstract/database_statements.rb:280:in `transaction'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/transactions.rb:212:in `transaction'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/transactions.rb:366:in `with_transaction_returning_status'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/transactions.rb:314:in `save'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/suppressor.rb:44:in `save'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] devise (4.7.3) app/controllers/devise/registrations_controller.rb:19:in `create'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal/basic_implicit_render.rb:6:in `send_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/abstract_controller/base.rb:195:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal/rendering.rb:30:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/abstract_controller/callbacks.rb:42:in `block in process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:135:in `run_callbacks'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/abstract_controller/callbacks.rb:41:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal/rescue.rb:22:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal/instrumentation.rb:33:in `block in process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/notifications.rb:180:in `block in instrument'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/notifications/instrumenter.rb:24:in `instrument'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/notifications.rb:180:in `instrument'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal/instrumentation.rb:32:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal/params_wrapper.rb:245:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activerecord (6.0.3.4) lib/active_record/railties/controller_runtime.rb:27:in `process_action'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/abstract_controller/base.rb:136:in `process'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionview (6.0.3.4) lib/action_view/rendering.rb:39:in `process'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal.rb:190:in `dispatch'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_controller/metal.rb:254:in `dispatch'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/routing/route_set.rb:50:in `dispatch'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/routing/route_set.rb:33:in `serve'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/routing/mapper.rb:18:in `block in <class:Constraints>'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/routing/mapper.rb:48:in `serve'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/journey/router.rb:49:in `block in serve'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/journey/router.rb:32:in `each'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/journey/router.rb:32:in `serve'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/routing/route_set.rb:834:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] omniauth (1.9.1) lib/omniauth/strategy.rb:192:in `call!'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] omniauth (1.9.1) lib/omniauth/strategy.rb:169:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] warden (1.2.9) lib/warden/manager.rb:36:in `block in call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] warden (1.2.9) lib/warden/manager.rb:34:in `catch'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] warden (1.2.9) lib/warden/manager.rb:34:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/tempfile_reaper.rb:15:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/etag.rb:27:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/conditional_get.rb:40:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/head.rb:12:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/http/content_security_policy.rb:18:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/session/abstract/id.rb:266:in `context'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/session/abstract/id.rb:260:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/cookies.rb:648:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/callbacks.rb:27:in `block in call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/callbacks.rb:101:in `run_callbacks'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/callbacks.rb:26:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/actionable_exceptions.rb:18:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/debug_exceptions.rb:32:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/show_exceptions.rb:33:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] railties (6.0.3.4) lib/rails/rack/logger.rb:37:in `call_app'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] railties (6.0.3.4) lib/rails/rack/logger.rb:26:in `block in call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:80:in `block in tagged'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:28:in `tagged'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/tagged_logging.rb:80:in `tagged'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] railties (6.0.3.4) lib/rails/rack/logger.rb:26:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/remote_ip.rb:81:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/request_id.rb:27:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/method_override.rb:24:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/runtime.rb:22:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] activesupport (6.0.3.4) lib/active_support/cache/strategy/local_cache_middleware.rb:29:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/executor.rb:14:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/static.rb:126:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] rack (2.2.3) lib/rack/sendfile.rb:110:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] actionpack (6.0.3.4) lib/action_dispatch/middleware/host_authorization.rb:76:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] railties (6.0.3.4) lib/rails/engine.rb:527:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] puma (4.3.7) lib/puma/configuration.rb:228:in `call'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] puma (4.3.7) lib/puma/server.rb:713:in `handle_request'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] puma (4.3.7) lib/puma/server.rb:472:in `process_client'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] puma (4.3.7) lib/puma/server.rb:328:in `block in run'
the-mat-house | 2021-01-01 22:46:03 [33aeba17-bc52-4b8c-be9a-76b1bb608cae] puma (4.3.7) lib/puma/thread_pool.rb:134:in `block in spawn_thread'

我不得不在表单中省略模态代码,因为它使我超出了发布限制。如果您需要查看它,请告诉我,我会将其添加到答案中。

这是我的 environment.rb 文件:

# Load the Rails application.
require_relative 'application'

# Initialize the Rails application.
Rails.application.initialize!
  ActionMailer::Base.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
   :tls => true,
   :address => "smtpout.secureserver.net",
   :port => 25,
   :domain => "themathouse.com",
   :authentication => :login,
   :user_name => "username",
   :password => "password"
 }

这是我的 environment/production.rb 代码:

config.action_mailer.default_url_options = {:host => 'smtpout.secureserver.net'}
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
  :address => "68.178.213.243",
  :port    => 25,
  :domain  => 'themathouse.com'
}

谢谢

2 个答案:

答案 0 :(得分:0)

在我的个人项目中,我使用以下配置从 Devise 发送了电子邮件(我使用 SendGrid 和 Heroku 进行生产): production.rb

  config.action_mailer.default_url_options = { host: 'webserver.com' }
  config.action_mailer.delivery_method = :smtp
  ActionMailer::Base.smtp_settings = {
    address: 'smtp.sendgrid.net',
    port: 587,
    user_name: 'apikey',
    password: ENV['SENDGRID_API_KEY'],
    domain: ENV['SENDGRID_DOMAIN'],
    authentication: :plain,
    enable_starttls_auto: true
  }

devise.rb

  config.mailer_sender = 'app@webserver.com'

我的 environment.rb 文件中没有任何配置

附言我使用“Letter Opener”https://github.com/ryanb/letter_opener 进行开发。

答案 1 :(得分:0)

我想通了。我的域托管在其他地方,但它由 digitalocean 为我的应用程序管理,所以我必须在 digitalocean 为我的电子邮件设置 MX 记录,我想我有一个错误,所以我删除了它们并重新开始。

我还更新了 production.rb 文件:

config.action_mailer.default_url_options = {:host => 'mydomain.com'}
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
  :address => "mysmtpout.host",
  :port    => 25,
  :domain  => 'mydomain.com'
}