# 首次注册邮箱未收到

**URL:** https://meta.discourse.org/t/first-register-email-not-sent/402893
**Category:** Support
**Tags:** email
**Created:** [2026年五月13日 17:18 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893 "2026-05-13T17:18:46Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![zigobs](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@zigobs](https://meta.discourse.org/u/zigobs)
#### Post date: [2026年五月13日 17:18 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/1 "2026-05-13T17:18:46Z")

</div>

你好，

我刚完成了一次 Discourse 的 [全新安装](https://github.com/discourse/discourse/blob/main/docs/INSTALL-cloud.md)。

首次连接时，系统要求我为管理员账户创建用户名和密码，并应向我发送一封激活邮件。

但我没有收到这封激活邮件（当然我也检查了垃圾邮件文件夹），于是我 [求助了“医生”](https://meta.discourse.org/t/troubleshoot-email-on-a-new-discourse-install/16326)，并按照要求向自己发送了一封测试邮件。这封邮件立即出现在我的收件箱中。

 ![discourse-doctor-email](https://global.discourse-cdn.com/meta/original/4X/a/0/6/a06730780b68ec807d34204398cc63b23f9bf34c.png)

我知道可以通过命令行创建管理员账户，但我希望了解具体发生了什么，因为未来尝试注册的用户也可能遇到同样的问题。

您能帮忙吗？

此致，

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2026年五月13日 17:54 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/2 "2026-05-13T17:54:40Z")

</div>

> [@zigobs](#):
>
> 我想了解一下具体发生了什么

可能出现了以下两种问题之一：

- 邮件未发送
- 邮件已发送，但未能送达

由于这是一个新实例，最简单的方法是通过 Rails 控制台检查所有出站邮件日志：

```plaintext
discourse(prod)> EmailLog.all.pluck(:to_address, :email_type, :created_at, :smtp_transaction_response)

```

如果您看到有记录，说明邮件至少已移交至 SMTP 服务器，这也是 Discourse 责任的终点。

如果您没有看到任何记录，则邮件很可能未发送。您可以尝试以管理员身份登录后，访问 `/logs` 和 `/sidekiq` 路径，查看是否有相关的日志信息。

---

<div class="post-metadata">

### Author: ![zigobs](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@zigobs](https://meta.discourse.org/u/zigobs)
#### Post date: [2026年五月13日 19:31 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/3 "2026-05-13T19:31:30Z")

</div>

我们可以看到，使用 `./discourse-doctor` 发送了 **测试** 消息（事实上我也确实收到了），但没有 **注册** 消息的记录：

```plaintext
discourse(prod)> EmailLog.all.pluck(:to_address, :email_type, :created_at, :smtp_transaction_response)
=> [["user@domain.org", "test_message", 2026-05-13 16:23:41.417177000 UTC +00:00, "250 2.0.0 Ok: queued as 4B4DDB0059A"]]

```

我们在 production.log 文件中找到了四条注册消息（事实上我尝试注册了四次）。但这些注册消息从未被收到，因此我猜测它们从未被发送过，即使没有错误或警告。我们可以注意到，那些日志中并没有成功发送（并收到）的测试消息的踪迹。

```plaintext
root@my-vps-app:/var/www/discourse/log# cat production.log | grep user
  Parameters: {"authenticity_token" => "ityyLIdjT7xvdxEd01LjMT08-xxxx", "email" => "user@domain.org", "username" => "admin", "password" => "[FILTERED]", "commit" => "Register"}
  Parameters: {"authenticity_token" => "tnDxYkOOwXYcv59Ez4t8vWPir-xxxx", "email" => "user@domain.org", "username" => "admin", "password" => "[FILTERED]", "commit" => "Register"}
  Parameters: {"authenticity_token" => "bvOwVYHS3N_UELipxVEG3L3LY-xxxx", "email" => "user@domain.org", "username" => "admin", "password" => "[FILTERED]", "commit" => "Register"}
  Parameters: {"authenticity_token" => "oo6GN-n7clGI5F1-uqzsZcadeP-xxxx", "email" => "user@domain.org", "username" => "admin", "password" => "[FILTERED]", "commit" => "Register"}

```

其他日志文件为空：

```plaintext
root@my-vps-app:/var/www/discourse/log# cat production_errors.log 
root@my-vps-app:/var/www/discourse/log# cat sidekiq.log 
root@my-vps-app:/var/www/discourse/log# cat unicorn.stderr.log 
root@my-vps-app:/var/www/discourse/log# cat unicorn.stdout.log 

```

Discourse 应用的 Docker 日志显示了四条消息，提示某些内容缺失（而我们恰好有四条失败的注册消息）：

```plaintext
root@my-vps:/var/discourse# docker logs app
...
I, [2026-05-13T16:14:30.769269 #3290] INFO -- : worker=7 gen=0 pid=4295 registered
I, [2026-05-13T16:14:30.815178 #4295] INFO -- : worker=7 gen=0 pid=4295 ready
X-Accel-Mapping header missing
X-Accel-Mapping header missing
X-Accel-Mapping header missing
X-Accel-Mapping header missing

```

这能有所帮助吗？

---

<div class="post-metadata">

### Author: ![zigobs](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@zigobs](https://meta.discourse.org/u/zigobs)
#### Post date: [2026年五月16日 18:11 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/4 "2026-05-16T18:11:45Z")

</div>

由于注册邮件从未到达，我通过命令行激活了管理员账户。

我使用管理员账户登录，并从“管理员/邮件设置/服务器设置”发送了一封测试邮件到 [anotheruser@anotherdomain.org](mailto:anotheruser@anotherdomain.org)。

如下所示，该测试邮件立即发送并成功送达我的收件箱：

```plaintext
root@my-vps:/var/discourse# ./launcher enter app
x86_64 arch detected.
root@my-vps-app:/var/www/discourse# rails console
Loading production environment (Rails 8.0.5)
discourse(prod)> EmailLog.all.pluck(:to_address, :email_type, :created_at, :smtp_transaction_response)
=> 
[["user@domain.org",
  "test_message",
  2026-05-13 16:23:41.417177000 UTC +00:00,
  "250 2.0.0 Ok: queued as 4B4DDB0059A"],
 ["anotheruser@anotherdomain.org",
  "test_message",
  2026-05-16 14:44:42.978862000 UTC +00:00,
  "250 2.0.0 Ok: queued as D79DFB00573"]]

```

随后，我尝试使用相同的邮箱地址（anotheruser@anotherdomain.org）进行注册，但注册邮件未被送达（也未发送，因为它没有出现在 Rails 控制台的日志中）。

总之，测试邮件可以正常发送并送达，但注册邮件却未被发送，尽管我们在 production.log 中找到了相关记录：

```plaintext
cat production.log | grep anotheruser
  Parameters: {"email_address" => "anotheruser@anotherdomain.org"}
Started GET "/u/check_email?email=anotheruser%40anotherdomain.org" for xxx.xxx.xxx.xxx at 2026-05-16 17:40:45 +0000
  Parameters: {"email" => "anotheruser@anotherdomain.org"}
  Parameters: {"email" => "anotheruser@anotherdomain.org", "password" => "[FILTERED]", "username" => "NewUser", "password_confirmation" => "[FILTERED]", "challenge" => "xxxxxxxx", "timezone" => "Europe/Paris"}

```

用户无法注册，请问我该如何解决？

---

<div class="post-metadata">

### Author: ![zigobs](https://avatars.discourse-cdn.com/v4/letter/z/e8c25b/32.png) [@zigobs](https://meta.discourse.org/u/zigobs)
#### Post date: [2026年五月19日 05:37 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/5 "2026-05-19T05:37:48Z")

</div>

我终于切换到另一个 SMTP 服务商，一切运行正常，但我很沮丧，因为没能搞清楚到底发生了什么……

---

<div class="post-metadata">

### Author: ![sniper756](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sniper756/32/545002_2.png) [@sniper756](https://meta.discourse.org/u/sniper756)
#### Post date: [2026年五月19日 06:17 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/6 "2026-05-19T06:17:01Z")

</div>

有的邮箱就是不行，我一开始也耗用很长时间，找不到原因，后来使用mailgun 就没问题，我知道的qq邮箱对discourse的支持不好用。

---

<div class="post-metadata">

### Author: ![supermathie](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/supermathie/32/507518_2.png) [@supermathie](https://meta.discourse.org/u/supermathie)
#### Post date: [2026年五月19日 18:55 UTC](https://meta.discourse.org/t/first-register-email-not-sent/402893/7 "2026-05-19T18:55:20Z")

</div>

> [@zigobs](#):
>
> 人们无法注册，我该如何解决这个问题？

以管理员身份登录后，这里是否显示了任何内容：

> [@supermathie](#):
>
> 如果没有，那可能邮件并未发送。以管理员身份登录后，您可以检查 `/logs` 和 `/sidekiq` 路径，以找到具有参考价值的日志。

那里应该有足够的信息来帮助您找出问题所在。
