2.4. Configuring Postfix as a destination for multiple domains


You can configure Postfix as a mail server that can receive emails for multiple domains. In this configuration, Postfix acts as the final destination for emails sent to addresses within the specified domains. You can configure the following:

  • Set up multiple email addresses that point to the same email destination
  • Route incoming email for multiple domains to the same Postfix server

Prerequisites

  • You have the root access.
  • You have configured a Postfix server.

Procedure

  1. In the /etc/postfix/virtual virtual alias file, specify the email addresses for each domain. Add each email address on a new line:

    <info@example.com>   <user22@example.net>
    <sales@example.com>  <user11@example.org>

    In this example, Postfix redirects all emails sent to info@example.com to user22@example.net and email sent to sales@example.com to user11@example.org.

  2. Create a hash file for the virtual alias map:

    # postmap /etc/postfix/virtual

    This command creates the /etc/postfix/virtual.db file. Note that you must always re-run this command after you update the /etc/postfix/virtual file.

  3. In the Postfix /etc/postfix/main.cf configuration file, add the virtual_alias_maps parameter and point it to the hash file:

    virtual_alias_maps = hash:/etc/postfix/virtual
  4. Reload the postfix service to apply the changes:

    # systemctl reload postfix

Verification

  • Test the configuration by sending an email to one of the virtual email addresses.

Troubleshooting

  • In case of errors, check the /var/log/maillog file.
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2026 Red Hat
返回顶部