# 设置 mail-receiver 后，网站无法发送邮件？

**URL:** https://meta.discourse.org/t/set-up-mail-receiver-but-now-site-wont-send-any-emails/283817
**Category:** Self-hosting
**Tags:** email, mail-receiver
**Created:** [2023年九月25日 10:05 UTC](https://meta.discourse.org/t/set-up-mail-receiver-but-now-site-wont-send-any-emails/283817 "2023-09-25T10:05:52Z")
**Posts on this page:** 1
**Showing post:** 8

<div class="post-metadata">

### Author: ![Simon\_Manning](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/simon_manning/32/198596_2.png) [@Simon\_Manning](https://meta.discourse.org/u/Simon_Manning)
#### Post date: [2023年九月26日 16:12 UTC](https://meta.discourse.org/t/set-up-mail-receiver-but-now-site-wont-send-any-emails/283817/8 "2023-09-26T16:12:57Z")

</div>

这是另一种情况，尽管有关联。那是来自外部的连接，Docker 会添加规则以允许暴露的端口通过。

> [@supermathie](#):
>
> ```plaintext
> Chain DOCKER (2 references)
> pkts bytes target prot opt in out source destination         
> 0 0 RETURN all -- docker0 any anywhere anywhere            
> 0 0 DNAT tcp -- !docker0 any anywhere anywhere tcp dpt:https to:172.17.0.2:443
> 107 6848 DNAT tcp -- !docker0 any anywhere anywhere tcp dpt:http to:172.17.0.2:80
> 
> ```

我对 netfilter/iptables 链规则不太熟悉，但我认为上面的内容显示：

1. 如果连接来自 `docker0`，即来自默认的 Docker 网络，则返回到上一个链（停止在该链中处理规则）。
2. 否则，如果连接来自 `docker0` 以外的任何地方，如果它也是 https 或 http，则指定 DNAT，使其继续进入 FORWARD 链。

因此，在另一个主题中显示的安排中，如果 https 或 http 流量来自外部，它将被定向到 Docker。但是，如果流量来自 Docker 网络，它将被返回并被 INPUT 链拒绝或丢弃。

`ufw allow https` 的作用是在 INPUT 链中添加一条接受规则。这样，当连接按上述方式返回到 INPUT 链时，它将被接受并找到正在侦听的 Docker，最终被路由到容器。

---

_[View the full topic](https://meta.discourse.org/t/set-up-mail-receiver-but-now-site-wont-send-any-emails/283817)._
