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

Relay host based on destination MX record

· 52CE 我爱测

I wish to set up Postfix to use an external relay depending on the destination hostname, ie: If destination hostname is *.outlook.com, use relay some_smtp.example.com If any other destination hostname, use local relay What I mean…

问题原文

原帖链接 · BinaryDeuce · CC BY-SA 3.0

I wish to set up Postfix to use an external relay depending on the destination hostname, ie:

  • If destination hostname is *.outlook.com, use relay some_smtp.example.com
  • If any other destination hostname, use local relay

What I mean by destination hostname is the hostname obtained from MX record. If the recipient domain has MX record microsoft-com.mail.protection.outlook.com, then use a different relay

I know it is possible to specify a relay depending on the sender address (using sender_dependent_relayhost_maps), but it's impractical in my situation.

The goal is to use a different relay for finicky destination hosts: maybe Mandrill, or another Postfix installation.

社区高分解答

原帖链接 · Arul Selvan · CC BY-SA 4.0

You can setup a transport map to selectively choose mails with @outlook.com as destination address and relay them via some_smtp.example.com as shown below.

Add the entry below to /etc/postfix/transport

outlook.com smtp:[some_smtp.example.com]

Add the entry below to /etc/postfix/main.cf

transport_maps = hash:/etc/postfix/transport

Restart postfix after the following command

sudo postmap /etc/postfix/transport

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

资料来源与适用范围

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

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

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