配置QQ邮箱发件,邮件正常到达,但是Discourse报错,会重复发送

AI 生成的摘要

A user reports issues with configuring QQ Mail for sending emails in Discourse, where emails are successfully delivered but Discourse repeatedly sends them and shows errors. The user’s configuration includes SMTP settings for smtp.qq.com with port 587, and the problem occurs during user registration and test emails. Logs show an SMTP Error Net::SMTPUnknownError with unclear messages. The user shares error logs and a doctor report, and others confirm similar issues with QQ Mail, suggesting it’s a known problem. A developer acknowledges the issue and notes a fix has been merged to improve error messages. Another user confirms that using Mailgun resolves the issue, and a developer notes that QQ Mail is a recurring source of problems. The consensus is that the issue is likely due to QQ Mail’s behavior rather than Discourse configuration.

我最初遵守的安装教程:

我的设置:

  DISCOURSE_DEVELOPER_EMAILS: 'xxx@gmail.com'

  ## TODO: Configure the mail server
  ##       (used for validation of new accounts, notifications, digests, etc.)
  ## required: hostname of the SMTP mail server used to send mail
  DISCOURSE_SMTP_ADDRESS: smtp.qq.com
  ## uncomment to set the port to something other than the default (25)
  DISCOURSE_SMTP_PORT: 587
  ## USER_NAME / PASSWORD required if the SMTP provider needs authentication
  ## WARNING: a '#' in the SMTP password can be misinterpreted; ensure it's inside string quotes, e.g.:
  ##   DISCOURSE_SMTP_PASSWORD: "#pass#ord"
  DISCOURSE_SMTP_USER_NAME: xxx@qq.com
  DISCOURSE_SMTP_PASSWORD: "xxx"
  ## uncomment to enable implicit TLS at connection time, probably needed for using port 465
  #DISCOURSE_SMTP_FORCE_TLS: true
  ## uncomment to set the HELO/EHLO domain, only set if required by provider
  #DISCOURSE_SMTP_DOMAIN: discourse.example.com
  ## the address from which notifications are sent
  DISCOURSE_NOTIFICATION_EMAIL: xxx@qq.com
  ## uncomment to change server certificate verification
  #DISCOURSE_SMTP_OPENSSL_VERIFY_MODE: peer # peer|none
  ## uncomment to override the authentication method
  DISCOURSE_SMTP_AUTHENTICATION: login # plain|login|cram_md5

情况1:

尝试用户注册时,Discourse会反复发送邮件。


我不得不在sidekiq中手动终止重试任务

情况2:

我尝试使用内部测试邮件
点击发送后,提示错误。
但是,当我打开邮箱,发现邮件成功到达。

如果有人可以帮我解决这个难题,我将继续使用QQ邮箱,否则我不得不尝试更换邮箱。

yourforum.com/logs 中有错误吗?

您的问题让我想起了 我搭建了discourse,激活了账户邮箱,为什么还是每隔一会儿不断发送激活账户信息的邮件??怎么配置解决这个bug - #23 by supermathie 和 Duplicate registration email issue

感谢回复,你提供的两个案例与我的情况几乎一样,我仔细查看了相关内容,但还是搞不清楚如何解决。

logs确实存在错误。


你好,抱歉出现这种情况。我正在努力修复此问题以提供实际的错误消息。合并后我会在此回复。

你好,PR 已经合并。在您获取到更新后的代码后,请告诉我您是否仍然没有看到人类可读的错误消息。

这是我运行doctor的记录
https://mathcollapse.20000816.xyz/ZWM4MzAzZjUzZDZjMGU1.txt

这是更新后的错误日志

Message (2 copies reported)

SMTP Error Net::SMTPUnknownError with message: 
 response: 


Backtrace

/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.4/lib/active_support/broadcast_logger.rb:218:in `block in dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.4/lib/active_support/broadcast_logger.rb:217:in `map'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.4/lib/active_support/broadcast_logger.rb:217:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/activesupport-8.0.4/lib/active_support/broadcast_logger.rb:129:in `error'
/var/www/discourse/lib/email/sender.rb:308:in `rescue in send'
/var/www/discourse/lib/email/sender.rb:295:in `send'
/var/www/discourse/lib/tasks/emails.rake:230:in `block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:279:in `block in execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:279:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:279:in `execute'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:219:in `block in invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:199:in `synchronize'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:199:in `invoke_with_call_chain'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/task.rb:188:in `invoke'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:188:in `invoke_task'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:138:in `block (2 levels) in top_level'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:138:in `each'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:138:in `block in top_level'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:147:in `run_with_threads'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:132:in `top_level'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:83:in `block in run'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:214:in `standard_exception_handling'
/var/www/discourse/vendor/bundle/ruby/3.3.0/gems/rake-13.3.1/lib/rake/application.rb:80:in `run'
bin/rake:13:in `<top (required)>'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/cli/exec.rb:59:in `load'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/cli/exec.rb:59:in `kernel_load'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/cli/exec.rb:23:in `run'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/cli.rb:452:in `exec'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/vendor/thor/lib/thor/command.rb:28:in `run'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/vendor/thor/lib/thor/invocation.rb:127:in `invoke_command'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/vendor/thor/lib/thor.rb:538:in `dispatch'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/cli.rb:35:in `dispatch'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/vendor/thor/lib/thor/base.rb:584:in `start'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/cli.rb:29:in `start'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/exe/bundle:28:in `block in <top (required)>'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/lib/bundler/friendly_errors.rb:117:in `with_friendly_errors'
/usr/local/lib/ruby/gems/3.3.0/gems/bundler-2.6.4/exe/bundle:20:in `<top (required)>'
/usr/local/bin/bundle:25:in `load'
/usr/local/bin/bundle:25:in `<main>'

感谢您的帮助,但是目前我仍然无法解决qq邮箱问题,所以不得不更换为gmail邮箱,目前已经完全正常。

qq邮箱不行,我也出现同样问题,用mailgun能解决问题

嗯,哎呀,很抱歉没有提供更好的错误信息,但很高兴听到您无论如何都解决了这个问题。我已经开了一个内部主题以作进一步调查,也许会更新一些文档来警告这个问题,但这似乎是 QQ 邮箱特有的一个反复出现的问题。多年来已经有多个关于 QQ 邮箱导致相同问题的报告。

看来这就是 QQ 邮箱的通病! 不是 discourse 设置问题