# 安装后无法完成电子邮件验证

**URL:** https://meta.discourse.org/t/post-install-cant-complete-email-verification/175147
**Category:** Self-hosting
**Created:** [2021年一月5日 11:05 UTC](https://meta.discourse.org/t/post-install-cant-complete-email-verification/175147 "2021-01-05T11:05:51Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![Codes9](https://avatars.discourse-cdn.com/v4/letter/c/ea5d25/32.png) [@Codes9](https://meta.discourse.org/u/Codes9)
#### Post date: [2021年一月5日 11:05 UTC](https://meta.discourse.org/t/post-install-cant-complete-email-verification/175147/1 "2021-01-05T11:05:51Z")

</div>

我已在新的 VPS 上安装了 Discourse，但无法完成验证和登录。

**我一直参考的是**

> [@Troubleshoot email on a new Discourse install](https://meta.discourse.org/t/troubleshooting-email-on-a-new-discourse-install/16326):
>
> You just installed Discourse via [the install guide](https://github.com/discourse/discourse/blob/main/docs/INSTALL.md), but email doesn’t seem to work. Unfortunately this means you can’t log in as an admin to finalize the install. cry Let’s troubleshootize! Try the doctor woman_health_workerIf you run ./discourse-doctor it will check several ways that your mail configuration might be broken, and offer advice. Try that first. Did you enter email settings correctly? The simplest way is to run ./discourse-setup again. Did you enter everything correctly? B…

根据我的观察，问题似乎出在 Discourse 不认可邮件服务器的 SSL 主机名。该服务器配置为 mail.posklip.co.za。由于这是一台共享服务器，服务器主机名与邮件主机名不同。有人知道 Discourse 在报告此错误时期望的是什么吗？我是否应该将 Discourse 配置为使用主服务器名称？

**目前我已检查的其他事项**

**邮件服务器设置**  
我的邮件服务器已配置并在生产环境中作为共享托管服务器正常运行。DKIM、SSL 和 SPF 均已设置。我还将新服务器的 IP 地址添加到了我的 SPF 配置中。

**SSL 测试** ([https://ssl-tools.net/mailservers/mail.posklip.co.za](https://ssl-tools.net/mailservers/mail.posklip.co.za))

 ![image](https://global.discourse-cdn.com/meta/original/3X/9/4/94bbb5a0dd2118cd717316c72776ce09045394d9.png)

**生产日志**

```plaintext
root@29:/var/discourse# tail shared/standalone/log/rails/production.log
  Rendering layouts/email_template.html.erb
  Rendered layouts/email_template.html.erb (Duration: 0.1ms | Allocations: 32)
Delivered mail 6b773c78-face-4a27-bfcb-86f8c47a0790@gesels.posklip.co.za (413.3ms)
Job exception: hostname "mail.posklip.co.za" does not match the server certificate

  Rendering layouts/email_template.html.erb
  Rendered layouts/email_template.html.erb (Duration: 0.1ms | Allocations: 32)
Delivered mail 78e71b52-903e-4a55-a122-dde6d3ab87ad@gesels.posklip.co.za (366.5ms)
Job exception: hostname "mail.posklip.co.za" does not match the server certificate

```

---

<div class="post-metadata">

### Author: ![itsbhanusharma](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/itsbhanusharma/32/180717_2.png) [@itsbhanusharma](https://meta.discourse.org/u/itsbhanusharma)
#### Post date: [2021年一月5日 12:41 UTC](https://meta.discourse.org/t/post-install-cant-complete-email-verification/175147/2 "2021-01-05T12:41:15Z")

</div>

您需要在邮件服务器上安装正确的 SSL 证书。

 ![SmartSelect_20210105-181013_Chrome](https://global.discourse-cdn.com/meta/original/3X/7/d/7dd4990c124407810743cc72b401567cfd897f49.jpeg)

> **[SSL Server Test (Powered by Qualys SSL Labs)](https://www.ssllabs.com/ssltest/analyze.html?d=mail.posklip.co.za&hideResults=on)**
>
> A comprehensive free SSL test for your public web servers.

服务器上当前安装的证书未将 `mail.posklip.co.za` 列为其备用名称。

> **[SSL Server Test (Powered by Qualys SSL Labs)](https://www.ssllabs.com/ssltest/analyze.html?d=20.atservice.co.za&hideResults=on)**
>
> A comprehensive free SSL test for your public web servers.

---

<div class="post-metadata">

### Author: ![RGJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/rgj/32/523185_2.png) [@RGJ](https://meta.discourse.org/u/RGJ)
#### Post date: [2021年一月5日 15:51 UTC](https://meta.discourse.org/t/post-install-cant-complete-email-verification/175147/3 "2021-01-05T15:51:52Z")

</div>

更简单的方法：只需将您的邮件服务器配置为 `20.atservice.co.za`，而不是 `mail.posklip.co.za`。

---

<div class="post-metadata">

### Author: ![Codes9](https://avatars.discourse-cdn.com/v4/letter/c/ea5d25/32.png) [@Codes9](https://meta.discourse.org/u/Codes9)
#### Post date: [2021年一月5日 22:07 UTC](https://meta.discourse.org/t/post-install-cant-complete-email-verification/175147/4 "2021-01-05T22:07:22Z")

</div>

@RGJ 谢谢！这解决了问题。

因此，如果其他人也遇到此问题，且您的邮件服务器位于共享主机上，您需要使用共享主机的服务器主机名，而不是您域名的 DNS 名称来配置邮件服务器。
