您好 Discourse,
今天早上重建 mail-receiver 和应用程序后,我收到了之前发送的电子邮件的以下结果:
我已尝试此设置,但仍会退回
![IMG_087
这可能是更新 Ubuntu 内核后出现的系统时钟问题吗?
(作者已删除帖子)
okay so both the mail-receiver container and app container are set to a different time to the host system
它们似乎设置为不同的时区,这没关系。
假设您在几分钟内运行了这些命令,这看起来不错。
从这些截图中无法确切了解发生了什么。
您论坛的入站地址是什么?(如果可能,请稍微编辑)
它来自哪个地址?
发送到该地址的邮件发生了什么?
请使用日志文本而不是截图。
您的论坛的入站地址是什么?(如果可能,请稍微编辑)
它来自哪个地址?
发送到它的邮件发生了什么?
它连接到 mail-receiver,但 mail-receiver 将 IP 视为未知,因此将其退回,邮件未进入 mail-receiver 的队列。
mail-receiver 将 IP 视为未知,因此将其弹回
我不认为这是正确的。这是一个警告,而不是错误。
此屏幕截图(请将此文本)表明地址 ppyem30@discourse.domain.com 未被接受——这似乎是失败的原因。
我更倾向于查看 using backwards-compatible default setting… 这一行,这似乎暗示了原因。
root@ubuntu:/var/discourse# Jul 17 15:40:20 ubuntu-mail-receiver postfix/master[1]: 守护进程已启动 -- 版本 3.7.11,配置 /etc/postfix
Jul 17 15:41:32 ubuntu-mail-receiver postfix/smtpd[122]: 从 btprdrgo001.btinternet.com[65.20.50.131] 连接
Jul 17 15:41:32 ubuntu-mail-receiver postfix/smtpd[122]: 从 btprdrgo001.btinternet.com[65.20.50.131] 断开连接 ehlo=1 quit=1 commands=2
Jul 17 15:41:32 ubuntu-mail-receiver postfix/smtpd[122]: 从 btprdrgo001.btinternet.com[65.20.50.6] 连接
Jul 17 15:41:32 ubuntu-mail-receiver postfix/smtpd[122]: NOQUEUE: 拒绝: RCPT 来自 btprdrgo001.btinternet.com[65.20.50.6]: 554 5.7.1 <person@discourse.redacted.com>: 收件人地址被拒绝:不接受发往此地址的邮件。请检查地址后重试;来自=<ethan.mees@btinternet.com> 至=<person@discourse.redacted.com> proto=ESMTP helo=<btprdrgo001.btinternet.com>
Jul 17 15:41:32 ubuntu-mail-receiver postfix/smtpd[122]: 使用向后兼容的默认设置 smtpd_relay_before_recipient_restrictions=no 来拒绝来自客户端“btprdrgo001.btinternet.com[65.20.50.6]”的收件人“person@discourse.redacted.com”
Jul 17 15:41:32 ubuntu-mail-receiver postfix/smtpd[122]: 从 btprdrgo001.btinternet.com[65.20.50.6] 断开连接 ehlo=1 mail=1 rcpt=0/1 data=0/1 rset=1 quit=1 commands=4/6
Jul 17 15:42:49 ubuntu-mail-receiver postfix/smtpd[122]: 警告:主机名 unassigned.quadranet.com 未解析为地址 198.55.98.78
Jul 17 15:42:49 ubuntu-mail-receiver postfix/smtpd[122]: 从 unknown[198.55.98.78] 连接
Jul 17 15:42:49 ubuntu-mail-receiver postfix/smtpd[122]: 从 unknown[198.55.98.78] 断开连接 ehlo=1 auth=0/1 quit=1 commands=2/3
Jul 17 15:43:35 ubuntu-mail-receiver postfix/smtpd[122]: 从 unknown[196.251.92.207] 连接
Jul 17 15:43:36 ubuntu-mail-receiver postfix/smtpd[122]: 从 unknown[196.251.92.207] 断开连接 ehlo=1 quit=1 commands=2
following
./launcher destroy mail-receiver
then following the instructions here
Delivering mail sent to discourse.DOMAINNAME.com to Discourse
Starting OpenDKIM...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Adding user `postfix' to group `opendkim' ...
<86>Jul 17 16:00:00 usermod[17]: add 'postfix' to group 'opendkim'<86>Jul 17 16:00:00 usermod[17]: add 'postfix' to shadow group 'opendkim'Done.
Starting OpenDMARC...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
<22>Jul 17 16:00:00 opendkim[25]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)Adding user `postfix' to group `opendmarc' ...
<86>Jul 17 16:00:00 usermod[32]: add 'postfix' to group 'opendmarc'<86>Jul 17 16:00:00 usermod[32]: add 'postfix' to shadow group 'opendmarc'Done.
<22>Jul 17 16:00:00 opendmarc[40]: OpenDMARC Filter v1.4.2 starting (args: -c /etc/opendmarc.conf)<22>Jul 17 16:00:00 opendmarc[40]: additional trusted authentication services: (none)postfix: Postfix is using backwards-compatible default settings
Jul 17 16:00:00 ubuntu-mail-receiver postfix[52]: Postfix is using backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jul 17 16:00:00 ubuntu-mail-receiver postfix[52]: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Jul 17 16:00:00 ubuntu-mail-receiver postfix[52]: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Starting Postfix
Jul 17 16:00:00 ubuntu-mail-receiver postfix/master[1]: daemon started -- version 3.7.11, configuration /etc/postfix
Jul 17 16:00:28 ubuntu-mail-receiver postfix/smtpd[123]: connect from mail-ukwestazon11021090.outbound.protection.outlook.com[52.101.100.90]
Jul 17 16:00:28 ubuntu-mail-receiver postfix/smtpd[123]: NOQUEUE: reject: RCPT from mail-ukwestazon11021090.outbound.protection.outlook.com[52.101.100.90]: 554 5.7.1 <person@discourse.DOMAINNAME.com>: Recipient address rejected: Mail to this address is not accepted. Check the address and try to send again?; from=<ethan@DOMAINNAME.com> to=<person@discourse.DOMAINNAME.com> proto=ESMTP helo=<CWXP265CU009.outbound.protection.outlook.com>
Jul 17 16:00:28 ubuntu-mail-receiver postfix/smtpd[123]: using backwards-compatible default setting smtpd_relay_before_recipient_restrictions=no to reject recipient "person@discourse.DOMAINNAME.com" from client "mail-ukwestazon11021090.outbound.protection.outlook.com[52.101.100.90]"
Jul 17 16:00:28 ubuntu-mail-receiver postfix/smtpd[123]: disconnect from mail-ukwestazon11021090.outbound.protection.outlook.com[52.101.100.90] ehlo=1 mail=1 rcpt=0/1 quit=1 commands=3/4
错误详情
错误: 554 5.7.1 <person@discourse.YOURDOMAIN.com>: 收件人地址被拒绝:不接受发往此地址的邮件。请检查地址后重试?
拒绝邮件方: ubuntu-mail-receiver.localdomain
我更倾向于查看“使用向后兼容的默认设置…”这一行,这似乎暗示了原因。
我尝试了 ask.discourse.com
Supermathie 指的是 Discourse 直接投递邮件接收器设置支持的一项功能,您可以限制 Discourse 邮件接收器容器接受哪些电子邮件地址的邮件。这可以通过在邮件接收器的 Docker 容器配置中创建和挂载“valid_recipients”文件来完成,通常是在 mail-receiver.yml 中。
以下是它的含义以及为什么您要这样做:
mount_recipients 文件是什么意思?
在您的
mail-receiver.yml中,在volumes:部分下,添加此行:- /var/discourse/shared/mail-receiver/valid_recipients:/etc/postfix/valid_recipients此行指示 Docker 将主机系统上的
/var/discourse/shared/mail-receiver/valid_recipients文件映射到容器内的/etc/postfix/valid_recipients。
valid_recipients 文件有什么用?
您自己创建文件
/var/discourse/shared/mail-receiver/valid_recipients,每行放置一个有效的收件人电子邮件地址。例如:discourse@discourse.yourdomain.com incoming+test@discourse.yourdomain.com执行此操作后,Postfix 在邮件接收器容器中只会接受发送到这些地址之一的电子邮件。所有其他地址将在 SMTP 级别被拒绝。
为什么使用 valid_recipients 文件?
- 安全性:限制谁可以通过电子邮件发送到您的 Discourse,从而减少垃圾邮件或滥用的可能途径。
- 控制:您可以精确指定论坛将“监听”哪些地址,如果您有大量的自定义电子邮件路由或只想允许特定的群组或类别电子邮件地址,这将非常有用。
- 调试和过滤:通过确保只有预期的收件人才能接收邮件进行处理,有助于调试。
文档/讨论在哪里?
Discourse 元站点上的各种传入电子邮件设置指南中都概述了用法,但 Supermathie 的帖子提供了一种在 Postfix(SMTP 服务器)级别强制执行的快捷方式,而不仅仅是在 Discourse 的内部处理中。
以下是设置直接投递的概述,其中包含有关自定义 Postfix 以用于高级用法的更多详细信息:
- 为自托管站点配置直接投递传入电子邮件(使用 Mail-Receiver)
- 自定义邮件接收器容器的 Postfix 配置
您还可以在此元答案中找到有关“valid_recipients”方法的具体提示:- 电子邮件接收问题讨论
摘要:
Supermathie 的提示是一种在 SMTP 服务器级别严格控制 Discourse 将接收哪些电子邮件地址的方法,方法是在您的邮件接收器容器中挂载一个包含允许的收件人地址列表的“valid_recipients”文件。这有助于保护和控制传入的电子邮件。有关更多信息,请参阅官方指南:
我已经按照步骤操作。有一点需要澄清的是,当我进入 /var/discourse/shared/mail-receiver/ 目录时,
我应该输入
nano valid_recipients
还是
nano valid_recipients.yml。
这是在 mail-reciever.yml 中复制粘贴的操作,然后又进行了一次重建,对应下面的日志
root@ubuntu:/var/discourse# ./launcher logs mail-receiver
x86_64 arch detected.
/bin/bash: warning: setlocale: LC_ALL: cannot change locale (en_US.UTF-8)
Operating environment:
HOSTNAME=ubuntu-mail-receiver
LANGUAGE=en_US.UTF-8
MAIL_DOMAIN=discourse.DOMAINNAME.com
DOCKER_HOST_IP=172.17.0.1
PWD=/
DISCOURSE_BASE_URL=https://DOMAINNAME.com
HOME=/root
LANG=en_US.UTF-8
TERM=xterm
SHLVL=1
DISCOURSE_API_USERNAME=system
LC_ALL=en_US.UTF-8
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
INCLUDE_DMARC=true
DISCOURSE_API_KEY=[64 digit api key redacted]
_=/usr/bin/env
Delivering mail sent to discourse.DOMAINNAME.com to Discourse
Starting OpenDKIM...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
Adding user `postfix' to group `opendkim' ...
<86>Jul 17 19:38:44 usermod[16]: add 'postfix' to group 'opendkim'<86>Jul 17 19:38:44 usermod[16]: add 'postfix' to shadow group 'opendkim'Done.
Starting OpenDMARC...
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
LANGUAGE = "en_US.UTF-8",
LC_ALL = "en_US.UTF-8",
LANG = "en_US.UTF-8"
are supported and installed on your system.
perl: warning: Falling back to the standard locale ("C").
<22>Jul 17 19:38:44 opendkim[24]: OpenDKIM Filter v2.11.0 starting (args: -x /etc/opendkim.conf)Adding user `postfix' to group `opendmarc' ...
<86>Jul 17 19:38:44 usermod[31]: add 'postfix' to group 'opendmarc'<86>Jul 17 19:38:44 usermod[31]: add 'postfix' to shadow group 'opendmarc'Done.
<22>Jul 17 19:38:44 opendmarc[39]: OpenDMARC Filter v1.4.2 starting (args: -c /etc/opendmarc.conf)<22>Jul 17 19:38:44 opendmarc[39]: additional trusted authentication services: (none)postfix: Postfix is using backwards-compatible default settings
Jul 17 19:38:44 ubuntu-mail-receiver postfix[49]: Postfix is using backwards-compatible default settings
postfix: See http://www.postfix.org/COMPATIBILITY_README.html for details
Jul 17 19:38:44 ubuntu-mail-receiver postfix[49]: See http://www.postfix.org/COMPATIBILITY_README.html for details
postfix: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Jul 17 19:38:44 ubuntu-mail-receiver postfix[49]: To disable backwards compatibility use "postconf compatibility_level=3.6" and "postfix reload"
Starting Postfix
Jul 17 19:38:44 ubuntu-mail-receiver postfix/master[1]: daemon started -- version 3.7.11, configuration /etc/postfix
Jul 17 19:39:12 ubuntu-mail-receiver postfix/smtpd[171]: connect from smtp3.nottingham.ac.uk[128.243.44.55]
Jul 17 19:39:12 ubuntu-mail-receiver postfix/smtpd[171]: NOQUEUE: reject: RCPT from smtp3.nottingham.ac.uk[128.243.44.55]: 554 5.7.1 <person.self@discourse.DOMAINNAME.com>: Recipient address rejected: Mail to this address is not accepted. Check the address and try to send again?; from=<person@nottingham.ac.uk> to=<person.xytz@discourse.DOMAINNAME.com> proto=ESMTP helo=<smtp3.nottingham.ac.uk>
Jul 17 19:39:12 ubuntu-mail-receiver postfix/smtpd[171]: using backwards-compatible default setting smtpd_relay_before_recipient_restrictions=no to reject recipient "person.xytz@discourse.DOMAINNAME.com" from client "smtp3.nottingham.ac.uk[128.243.44.55]"
Jul 17 19:39:12 ubuntu-mail-receiver postfix/smtpd[171]: disconnect from smtp3.nottingham.ac.uk[128.243.44.55] ehlo=1 mail=1 rcpt=0/1 bdat=0/1 quit=1 commands=3/5
我为许多类别设置了自定义的入站电子邮件地址。格式是否需要更改为 category+<tag>@discourse.DOMAINNAME.com(用于直接发布到类别)?