配置邮件服务器以接收来自任何域的邮件

发布于 2024-10-13 07:09:54 字数 1459 浏览 9 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

红颜悴 2024-10-20 07:09:54

您不仅需要一个 Catch-All 配置(例如接受任何发往 *@abc.com 的邮件),还需要一个 Catch-Anything 配置来接受任何发往 *@* 的邮件?

如果您将 PCRE 支持编译到 Postfix 中,这是可能的。然后,您的配置中需要虚拟用户(请参阅 Posfix 文档)并按如下方式进行调整:

确保您的 Postfix 已配置为接受至少一个用户和一个域的邮件。并且这是经过测试的。

  1. main.conf中设置

    virtual_alias_domains =  
    virtual_alias_maps = 哈希:/etc/postfix/virtual_forwardings,pcre:/etc/postfix/virtual_forwardings.pcre  
    virtual_mailbox_domains = 哈希:/etc/postfix/virtual_domains,pcre:/etc/postfix/virtual_domains.pcre
    

hash: 部分是从文档中已知的。 pcre: 部分是新的。
hash: 部分也可以省略。

  1. 使用以下内容创建文件 virtual_domains.pcre

    <前><代码>/^.*/ 确定

这接受任何域作为有效的收件人域。

  1. 使用以下内容创建文件 virtual_forwardings.pcre

    /@.*/ [电子邮件受保护]
    

这会将任何域的任何本地部分转发到 Postfix 用户 [电子邮件受保护]。确保这是有效的虚拟或本地用户。

在此配置中,Postfix 似乎是一个开放中继,但它不中继其他域。它接受任何域的邮件并将邮件在本地传送到一个邮箱。

有时您会注意到一个日志条目告诉您“不要在我的目的地和虚拟配置中列出 abc.com”之类的内容。可以忽略此警告,因为这种“奇怪”的设置并不常见。

You want not only a Catch-All configuration like accepting any mail to *@abc.com but also to have a Catch-Anything configuration to accept any mail to *@* ?

This is possible if you have the PCRE support compiled into Postfix. Then you need virtual users in your configuration (see the Posfix documentation) and tweak it as follows:

Make sure that your Postfix is already configured to accept mail for at least one user and one domain. And that this is tested.

  1. In main.conf set

    virtual_alias_domains =  
    virtual_alias_maps = hash:/etc/postfix/virtual_forwardings, pcre:/etc/postfix/virtual_forwardings.pcre  
    virtual_mailbox_domains = hash:/etc/postfix/virtual_domains, pcre:/etc/postfix/virtual_domains.pcre
    

The hash: parts are the known from the docs. And the pcre: parts are new.
The hash: parts can also be omitted.

  1. Create the file virtual_domains.pcre with the following content:

    /^.*/       OK
    

This accepts any domain as valid recipient domain.

  1. Create the file virtual_forwardings.pcre with the following content:

    /@.*/     [email protected]
    

This forwards any local part of any domain to the Postfix user [email protected]. Make sure that this is a valid virtual or local user.

In this configuration it seems that Postfix is an Open Relay, but it does not relay for other domains. It accepts mails for any domain and locally delivers the mail to one mailbox.

Sometimes you will then notice a log entry telling you something like "don't list abc.com in mydestination and virtual config". This warning can be ignored as this "strange" setup is not usual.

左耳近心 2024-10-20 07:09:54

FTR:

另一种方法是将任何邮件发送到“some.local.user”(shell 用户)

中的postfix-pcre 包

必需: main.cf

luser_relay = some.local.user
local_recipient_maps =

virtual_alias_maps = pcre:/etc/postfix/virtual_alias.pcre

mydestination = $myhostname, pcre:/etc/postfix/mydestination.pcre

文件 :/etc/postfix/virtual_alias.pcre
(映射到“some.local.user”的包罗万象)

/\/@/            some.local.user

__

文件:/etc/postfix/mydestination.pcre(我们接受您向我们扔的任何内容)

/.*/    OK

FTR:

An alternative way to do it by sending any mail to "some.local.user" (a shell user)

Required: postfix-pcre package

in main.cf

luser_relay = some.local.user
local_recipient_maps =

virtual_alias_maps = pcre:/etc/postfix/virtual_alias.pcre

mydestination = $myhostname, pcre:/etc/postfix/mydestination.pcre

File: /etc/postfix/virtual_alias.pcre
(catchall mapped to "some.local.user")

/\/@/            some.local.user

__

File: /etc/postfix/mydestination.pcre (we accept whatever you throw at us)

/.*/    OK
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文