# 新安装的电子邮件不起作用“已隐藏，因此将被忽略”

**URL:** https://meta.discourse.org/t/new-install-email-not-working-shadowed-so-this-will-be-ignored/203682
**Category:** Self-hosting
**Created:** [2021年九月15日 20:49 UTC](https://meta.discourse.org/t/new-install-email-not-working-shadowed-so-this-will-be-ignored/203682 "2021-09-15T20:49:04Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![AndreTechExec](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@AndreTechExec](https://meta.discourse.org/u/AndreTechExec)
#### Post date: [2021年九月15日 20:49 UTC](https://meta.discourse.org/t/new-install-email-not-working-shadowed-so-this-will-be-ignored/203682/1 "2021-09-15T20:49:04Z")

</div>

在全新干净安装后，我无法让邮件功能正常运行。我已按照故障排除指南中的每一步操作 [此处](https://meta.discourse.org/t/troubleshooting-email-on-a-new-discourse-install/16326)。

我使用的是 Zoho 邮件服务。邮件设置非常简单：

```plaintext
DISCOURSE_SMTP_ADDRESS: smtp.zoho.com
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: forum@blockchainofthings.com
DISCOURSE_SMTP_PASSWORD: "redeacted"
DISCOURSE_SMTP_ENABLE_START_TLS: true # （可选，默认为 true）
DISCOURSE_SMTP_DOMAIN: blockchainofthings.com
DISCOURSE_NOTIFICATION_EMAIL: sys@blockchainofthings.com

```

我已从自定义命令部分中移除了注释。

```plaintext
- exec: rails r "SiteSetting.notification_email='forum@blockchainofthings.com'"

```

我可以从安装 Discourse 的 EC2 实例上通过 telnet 成功连接到 SMTP 服务器，没有任何问题。

运行 `./discourse-doctor` 时，我得到以下输出：

```plaintext
==================== 邮件测试 ====================
要进行更可靠的测试，请从 http://www.mail-tester.com/ 获取一个邮箱地址。
或者，只需给自己发送一封测试邮件。
请输入用于邮件测试的邮箱地址？（输入 'n' 跳过）[sys@blockchainofthings.com]: sue@rightclick.com
正在向 sue@rightclick.com 发送邮件...
正在使用 smtp.zoho.com:587 和用户名 forum@blockchainofthings.com 通过明文认证测试向 sue@rightclick.com 发送邮件。
SMTP 服务器连接成功。
正在向 sue@rightclick.com 发送邮件...
邮件发送失败。
到达文件末尾

```

日志中有一条奇怪的提示：“尝试将 notification\_email SiteSetting 更改为 [forum@blockchainofthings.com](mailto:forum@blockchainofthings.com)，但该设置被遮蔽，因此将被忽略！”这可能就是问题所在，但我不确定原因以及如何修复。

以下是日志的更多内容：

```plaintext
尝试将 notification_email SiteSetting 更改为 forum@blockchainofthings.com，但该设置被遮蔽，因此将被忽略！
创建作用域 :open。正在覆盖现有方法 Poll.open。
2021-09-15 20:22:27 +0000 来自 18.204.103.32 的 GET "/privacy" 请求已启动
正在由 StaticController#show 处理，格式为 */*
参数：{"id"=>"privacy"}
已渲染 static/show.html.erb，位于 layouts/crawler 中（耗时：7.7ms | 分配：963）
已渲染布局 layouts/crawler.html.erb（耗时：41.8ms | 分配：8467）
完成 200 OK，总耗时 114ms（视图：45.2ms | ActiveRecord：0.0ms | 分配：18560）
2021-09-15 20:22:27 +0000 来自 18.204.103.32 的 GET "/privacy" 请求已启动
正在由 StaticController#show 处理，格式为 */*
参数：{"id"=>"privacy"}
已渲染 static/show.html.erb，位于 layouts/crawler 中（耗时：5.2ms | 分配：931）
已渲染布局 layouts/crawler.html.erb（耗时：26.5ms | 分配：6343）
完成 200 OK，总耗时 59ms（视图：30.1ms | ActiveRecord：0.0ms | 分配：12955）
已渲染 layouts/email_template.html.erb（耗时：0.8ms | 分配：273）
已发送邮件 ac1148f5-a79f-4892-8982-8e6f512a3b04@forum.blockchainofthings.com（耗时 1462.1ms）
作业异常：到达文件末尾

创建作用域 :open。正在覆盖现有方法 Poll.open。
已渲染 layouts/email_template.html.erb（耗时：2.1ms | 分配：487）
已发送邮件 5e74a41c-48ee-4e14-b669-091665840076@forum.blockchainofthings.com（耗时 544.7ms）

```

如果您能提供关于如何解决这个全新安装中邮件问题的任何帮助，我将不胜感激。

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [2021年九月15日 20:55 UTC](https://meta.discourse.org/t/new-install-email-not-working-shadowed-so-this-will-be-ignored/203682/2 "2021-09-15T20:55:43Z")

</div>

> [@AndreTechExec](#):
>
> 日志中有一条有趣的提示：`An attempt was to change notification_email SiteSetting to forum@blockchainofthings.com however it is shadowed so this will be ignored!`（尝试将 SiteSetting 的 notification\_email 更改为 [forum@blockchainofthings.com](mailto:forum@blockchainofthings.com)，但由于被覆盖，此操作将被忽略！）。这可能就是问题所在，但我不确定原因或如何修复。

你需要在 `app.yml` 中修改它。这就是“被覆盖”（shadowed）所指的情况。

```
 DISCOURSE_NOTIFICATION_EMAIL: sys@blockchainofthings.com

```

如果 Zoho 要求你从 `forum@blockchainofthings.com` 而非其他地址发送邮件，你需要在 `app.yml` 中修改它。（我认为对于该设置，你可以运行 `./launcher destroy app; ./launcher start app` 而无需重新构建，但我不太确定了；它可能需要放在容器内的 `discourse.conf` 中。如果是这种情况，直接重新构建会更简单，除非你清楚所有这些步骤的含义）。

我不确定“到达文件末尾”（end of file reached）这条消息的含义或指示什么。

我不了解 Zoho 的事务性邮件服务，你指的是 [Reliable SMTP Relay & Transactional Email Sending API | Zoho ZeptoMail](https://www.zoho.com/zeptomail/) 吗？如果不是，你恐怕会面临很多麻烦。在我输入这段文字的时间里，你本可以配置好 Mailgun 并让它正常工作。

---

<div class="post-metadata">

### Author: ![AndreTechExec](https://avatars.discourse-cdn.com/v4/letter/a/6a8cbe/32.png) [@AndreTechExec](https://meta.discourse.org/u/AndreTechExec)
#### Post date: [2021年九月16日 01:41 UTC](https://meta.discourse.org/t/new-install-email-not-working-shadowed-so-this-will-be-ignored/203682/3 "2021-09-16T01:41:33Z")

</div>

谢谢！我将其更改为

```plaintext
DISCOURSE_NOTIFICATION_EMAIL: forum@blockchainofthings.com

```

现在完全正常了。

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2021年十月16日 01:42 UTC](https://meta.discourse.org/t/new-install-email-not-working-shadowed-so-this-will-be-ignored/203682/4 "2021-10-16T01:42:04Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
