Postfix incoming/outgoing mail routing 實作

Integrations-Postfix-340x216

 

玩自己隻Domain Linux server咁多年.從來都無點諗要多機黎form Infra. 哩個星期終於出現 需要prepare Zimbra 而有呢個做法嘅需要。

皆因唔想浪費 N年前起落嘅 CentOS server. 作為SMTP gateway 亦唔需要再reg DNS Record. Outbound SMTP relay 做得多。 但係Inbound絕對係第一次。

過程整足一日,但係明白之後絕對可以再諗得更複雜。

基本需求。。
同一Domain下,黎緊Zimbra email嘅email會經舊server(Gateway) route(relay)入,  Outbound 同樣 relay 出。
但係唯一exception.因為舊Server已有自己account用緊,需要keep住唔可以比account嘅email 都route走。

首先要係 postfix 既config /ect/postfix/main.cf,  加呢句 “transport_maps = hash:/etc/postfix/transport”

之後戲肉,係 /etc/postfix/transport 入面最低, 加以下
自己要留住唔route嘅email address , 接住係自己機器收

  • user@example.com     local:$myhost

其餘整個Domain都會relay去後面

  • example.com      relay:[Zimbra FQDN]

    做完之後只需要 行一次 postmap /etc/postfix/transport。
    再reload postfix 就OK。

    有趣嘅係,係一路試嘅過途中。 竟然出現local DNS唔識resolve 隔離部機。。 最後原因係DNS Zone file 錯。。。

Reference

transport(5): Postfix transport table format – Linux man page

Postfix manual – transport(5)