
在 Debian 伺服器中,我透過以下配置新增了第二個 IP/etc/network/interfaces
# The primary network interface
allow-hotplug eth0
iface eth0 inet static
address 1.1.1.1
netmask 255.255.255.255
gateway 1.1.1.1
auto eth0:1
iface eth0:1 inet static
address 1.1.1.2
netmask 255.255.255.255
現在,postfix
使用第二個 IP 而不是主 IP 發送電子郵件。
我為每個由 管理的網域使用專用 IP nginx
。是否可以透過該網域專用的 IP 從每個網域發送電子郵件?
如果不是,如何使用主IP發送電子郵件?
答案1
可以使用該網域專用的 IP 進行傳送。
您需要依賴寄件者的傳輸地圖。
像這樣:
加入/etc/postfix/main.cf:
sender_dependent_default_transport_maps=hash:/etc/postfix/sender_maps
/etc/postfix/sender_maps:
@domain1.com domain1_transport:
@domain2.com domain2_transport:
加入/etc/postfix/master.cf
domain1_transport unix - - - - - smtp -o smtp_bind_address=1.1.1.1
domain2_transport unix - - - - - smtp -o smtp_bind_address=1.1.1.2
執行postmap /etc/postfix/sender_maps
並重新載入 postfix。
要接受兩個 IP 上的郵件,最好inet_interfaces = all
在 main.cf 中包含
答案2
是否可以透過該網域專用的 IP 從每個網域發送電子郵件?
是的,你可以這麼做。嘗試使用以下命令更改 master.cf 設定檔:
ipaddress1:smtp inet n - n - - smtpd -o myhostname=hostname1
ipaddress2:smtp inet n - n - - smtpd -o myhostname=hostname2
重新啟動postfix並檢查發送郵件。