# 故障排除电子邮件配置 Mailjet

**URL:** https://meta.discourse.org/t/troubleshooting-email-config-mailjet/160308
**Category:** Self-hosting
**Created:** [2020年八月10日 05:05 UTC](https://meta.discourse.org/t/troubleshooting-email-config-mailjet/160308 "2020-08-10T05:05:13Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![CorruptBlu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/corruptblu/32/222475_2.png) [@CorruptBlu](https://meta.discourse.org/u/CorruptBlu)
#### Post date: [2020年八月10日 05:05 UTC](https://meta.discourse.org/t/troubleshooting-email-config-mailjet/160308/1 "2020-08-10T05:05:13Z")

</div>

> [@system](#):
>
> ## 您的电子邮件设置是否正确？
> 
> 请仔细检查 `containers/app.yml` 文件中的设置；最简单的方法是再次运行 `./discourse-setup`。有效的电子邮件部分应如下所示：
> 
> ```plaintext
> DISCOURSE_DEVELOPER_EMAILS: 'name@example.com'
> DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
> DISCOURSE_SMTP_PORT: 587
> DISCOURSE_SMTP_USER_NAME: postmaster@discourse.example.com
> DISCOURSE_SMTP_PASSWORD: aUd34cdWKCu6CTjfoH7ykk
> 
> ```
> 
> 请再次核对所有值的正确性。请注意， **所有内容必须对齐，没有前导的 `#` 字符，并且开发者电子邮件字段周围必须使用单引号。**

我使用的是 Mailjet，它未能发送注册管理员账户的邮件。因此我尝试了上述修复方法，但每当我在电子邮件周围添加单引号时，就会出现如下错误：

```plaintext
(<unknown>): did not find expected key while parsing a block mapping at line 40 column 3 -e LANG=en_US.UTF-8
YAML 语法错误。请检查您的 containers/*.yml 配置文件。

```

有人知道如何解决这个问题吗？

---

<div class="post-metadata">

### Author: ![neounix](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neounix/32/215617_2.png) [@neounix](https://meta.discourse.org/u/neounix)
#### Post date: [2020年八月10日 05:45 UTC](https://meta.discourse.org/t/troubleshooting-email-config-mailjet/160308/2 "2020-08-10T05:45:51Z")

</div>

> [@CorruptBlu](#):
>
> 有人知道如何修复这个问题吗？

你好 @CorruptBlu

`yml` 文件有时可能会比较复杂。

你可以考虑使用 `yml 语法检查器` 来检查你的容器 `yml` 文件。

我偶尔会使用这个工具：

> **[YAMLlint - The YAML Validator](https://www.yamllint.com/)**
>
> Validate, Verify and Reformat your YAML documents, optimized for Ruby on Rails

下面是一个示例，我们将整个 `yml` 文件复制粘贴进去进行测试（截图中显示了一些“感兴趣的环境变量”）：

 ![Screen Shot 2020-08-10 at 12.44.57 PM](https://global.discourse-cdn.com/meta/original/3X/5/9/59a3b5156f2dc0f7805159bb7e232bf9fbded72d.jpeg)

---

<div class="post-metadata">

### Author: ![CorruptBlu](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/corruptblu/32/222475_2.png) [@CorruptBlu](https://meta.discourse.org/u/CorruptBlu)
#### Post date: [2020年八月10日 15:14 UTC](https://meta.discourse.org/t/troubleshooting-email-config-mailjet/160308/3 "2020-08-10T15:14:56Z")

</div>

实际上，我并没有将域名连接到 Mailjet。现在已经修复了。
