# 还有其他 SMTP 587 端口的电子邮件出现各种错误

**URL:** https://meta.discourse.org/t/yet-other-smtp-587-port-email-various-errors/264267
**Category:** Self-hosting
**Tags:** email
**Created:** [2023年五月8日 14:07 UTC](https://meta.discourse.org/t/yet-other-smtp-587-port-email-various-errors/264267 "2023-05-08T14:07:40Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Hyan](https://avatars.discourse-cdn.com/v4/letter/h/5fc32e/32.png) [@Hyan](https://meta.discourse.org/u/Hyan)
#### Post date: [2023年五月8日 14:07 UTC](https://meta.discourse.org/t/yet-other-smtp-587-port-email-various-errors/264267/1 "2023-05-08T14:07:40Z")

</div>

不同的 SMTP 服务器可能会出现不同的错误，即使在使用 `./discourse-doctor` 进行测试时使用的是 587 端口。

1. **TLS 和 STARTTLS 是互斥的**  
到目前为止，此错误从未在 meta 中提及，您应该显式设置 `DISCOURSE_SMTP_FORCE_TLS: false`，否则它将与默认值为 true 的 `DISCOURSE_SMTP_ENABLE_START_TLS` 相冲突。这可能并非总是如此，但值得一试。

2. **SSL\_connect returned=1 errno=0 peeraddr=xxx.xxx.xxx.xxx:587 state=error: wrong version number**  
同样，设置 `DISCOURSE_SMTP_FORCE_TLS: false` 可以解决此问题。

3. **Net::SMTPAuthenticationError**  
这可能是由于您设置的凭据的用户名或密码错误，或者可以通过设置 `DISCOURSE_SMTP_AUTHENTICATION: login` 来解决。

---

<div class="post-metadata">

### Author: ![savionlee](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/savionlee/32/323468_2.png) [@savionlee](https://meta.discourse.org/u/savionlee)
#### Post date: [2023年八月30日 14:59 UTC](https://meta.discourse.org/t/yet-other-smtp-587-port-email-various-errors/264267/2 "2023-08-30T14:59:49Z")

</div>

对于 Mailgun，在全新安装时，我必须执行以下操作：

```plaintext
DISCOURSE_SMTP_FORCE_TLS: true
DISCOURSE_SMTP_ENABLE_START_TLS: false

```

`./discourse-doctor` 报告：

```plaintext
======================================== ERROR ========================================
                                    UNEXPECTED ERROR

Net::ReadTimeout

```

整个故障排除文档 [Troubleshoot email on a new Discourse install - documentation / sysadmin - Discourse Meta](https://meta.discourse.org/t/troubleshoot-email-on-a-new-discourse-install/16326) 并没有解决我的问题。

我发现了这个关于修改它的帖子，它本可以帮到我：[Cannot send email - problem with port 465 - installation - Discourse Meta](https://meta.discourse.org/t/cannot-send-email-problem-with-port-465/246004/9)

然后，我发现了您发布的另一个帖子，其中显示了一些我需要进行的调整。

---

<div class="post-metadata">

### Author: ![ambimorph](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/ambimorph/32/441885_2.png) [@ambimorph](https://meta.discourse.org/u/ambimorph)
#### Post date: [2024年八月19日 02:17 UTC](https://meta.discourse.org/t/yet-other-smtp-587-port-email-various-errors/264267/3 "2024-08-19T02:17:15Z")

</div>

> [@savionlee](#):
>
> ```plaintext
> DISCOURSE_SMTP_FORCE_TLS: true
> DISCOURSE_SMTP_ENABLE_START_TLS: false
> 
> ```

此解决方案对我有用，之后进行了重建。

谢谢！
