大网数据广告活动
服务器运维问答

POSTFIX how to use a relayserver just for a specific domain?

· 52CE 我爱测

I have two email servers: mx1.example.com (IMAP, SMTP) and mx2.example.com (SMTP gateway). mx1.example.com is handling email for example.com , example.net and example.org . mx2.example.com is configured as a gateway for mx1.examp…

问题原文

原帖链接 · Max Muster · CC BY-SA 4.0

I have two email servers: mx1.example.com (IMAP, SMTP) and mx2.example.com (SMTP gateway).

  • mx1.example.com is handling email for example.com, example.net and example.org.
  • mx2.example.com is configured as a gateway for mx1.example.com
    (I want him to send out all mails that originate from mx1.example.com)

Now I want to send the emails

  • from example.com and example.net via mx1.example.com normally
  • from example.org via mx1.example.com (password auth) to the gateway mx2.example.com (IP).

How can I configure this?

UPDATE: Please hurry up guys, the bounty expires in 2 days.

To be more clear: I know how to relay via mx2.example.com (how to send everything via mx2.) I just have to put the IP of mx2 in relayhost in the main.cf in mx1. But I want to make this selectively, just for example.org.

已采纳解答

原帖链接 · Anylyn Hax · CC BY-SA 4.0

you cannot use transport as it is used to transport emails to the MAILBOX, you need to use

sender_dependent_relayhost_maps

it works like this in your main.cf:

relayhost = mx1.example.org, mx2.example.org 
relay_domains = example.com, example.org, example.net

smtp_sender_dependent_authentication = yes
sender_dependent_relayhost_maps = hash:/etc/postfix/relaymap

/etc/postfix/relaymap looks like this :

@example.com    mx1.example.com
@example.net    mx1.example.com

@example.org    mx2.example.com

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2020-05-18)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 4.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。