無法使用 Postfix 和 Webmin 為外寄電子郵件指派不同的 IP

無法使用 Postfix 和 Webmin 為外寄電子郵件指派不同的 IP

我正在嘗試將 Mac Mini M1 作為 SMTP 郵件伺服器運行。我有 5 個靜態 IP,每個都有自己的網路接口,有 5 個不同的域(具有相應的 PTR 記錄)。

我已成功安裝 Webmin,並且正在嘗試使用 Postfix 設定郵件伺服器。

這是我的 main.cf 中的非預設參數

biff    no
compatibility_level 2
debugger_command    PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin ddd $daemon_directory/$process_name $process_id & sleep 5
html_directory  /usr/share/doc/postfix/html
mail_owner  _postfix
mailbox_size_limit  0
manpage_directory   /usr/share/man
message_size_limit  10485760
mydestination   domain1.org, domain2.com, domain3.net, domain4.net, domain5.org
mynetworks  127.0.0.0/8, [::1]/128
mynetworks_style    subnet
queue_directory /private/var/spool/postfix
readme_directory    /usr/share/doc/postfix
recipient_delimiter +
sample_directory    /usr/share/doc/postfix/examples
sender_dependent_default_transport_maps hash:/etc/postfix/sender_transport
setgid_group    _postdrop
smtpd_client_restrictions   permit_mynetworks permit_sasl_authenticated permit

我已在 mydestination 下新增了 5 個網域。我成功收到了他們的電子郵件。由於我希望每個網域都使用自己的 IP 來發送電子郵件,因此我在 /etc/postfix/sender_transport 中新增了 sender_dependent_default_transport_maps ,如下所示:

@domain1.org    uniqueid1:
@domain2.org    uniqueid2:
@domain3.net    uniqueid3:
@domain4.com    uniqueid4:
@domain5.net    uniqueid5:

然後在 master.cf 的末尾我添加了以下內容以將網域連接到 IP:

uniqueid1  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.120
   -o smtp_helo_name=domain1.org
   -o syslog_name=postfix-customer-uniqueid1

uniqueid2  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.121
   -o smtp_helo_name=domain2.org
   -o syslog_name=postfix-customer-uniqueid2

uniqueid3  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.122
   -o smtp_helo_name=domain3.net
   -o syslog_name=postfix-customer-uniqueid3

uniqueid4  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.123
   -o smtp_helo_name=domain4.com
   -o syslog_name=postfix-customer-uniqueid4

uniqueid5  unix -       -       n       -       -       smtp
   -o smtp_bind_address=123.123.123.124
   -o smtp_helo_name=domain5.net
   -o syslog_name=postfix-customer-uniqueid5

我已經運行了 postmap hash:/etc/postfix/sender_transport,而且我也多次重新啟動了 postfix。

每次我嘗試發送電子郵件時,它總是來自domain1.org以及與其對應的第一個IP 123.123.123.120。

相關內容