Postfix 設定 - 子網域和網域的不同伺服器

Postfix 設定 - 子網域和網域的不同伺服器

我有以下設定: 1 個 postfix 伺服器:a.example.com需要接受 example.com ( *@*.example.com) 上任何子網域的所有電子郵件,並將電子郵件發送到郵遞員帳戶,並將電子郵件發送到任何電子郵件帳戶(gmail、yahoo 等),包括*@example.com. 1 個託管交換:exch11.hosted.com例如 example.com 電子郵件 ( *@example.com)。

除了從 a.example.com 發送電子郵件到*@example.com( exch11.hosted.com) 之外,此設定中的所有操作均正常。如果我有example.commydomains.db 文件,則a.example.com不會發送*@example.com電子郵件並在本地發送。如果我將其更改為,*.example.com那麼它會發送*@example.com電子郵件,exch11.hosted.com但現在不接受*@subdomain.example.com電子郵件並顯示不允許中繼的錯誤(它不應該中繼並傳遞到本機 maildir 帳戶)。

主要要求是讓 a.example.com 接受任何子網域的郵件並將主網域的電子郵件傳送到 exch11.hosted.com。有人可以幫助我或指出我正確的方向嗎?

歡迎任何幫助。

謝謝。

主要.cf:

command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
mydestination = hash:/etc/postfix/mydomains
unknown_local_recipient_reject_code = 550
alias_maps = hash:/etc/aliases
home_mailbox = Maildir/
smtpd_banner = mail.example.com

debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     xxgdb $daemon_directory/$process_name $process_id & sleep 5

sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.3.3/samples
readme_directory = /usr/share/doc/postfix-2.3.3/README_FILES
virtual_alias_maps = hash:/etc/postfix/virtual, pcre:/etc/postfix/virtual.pcre
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
smtp_sasl_security_options = noplaintext
#smtpd_sender_restrictions = check_sender_access hash:/etc/postfix/sender-access
smtpd_recipient_restrictions = check_recipient_access hash:/etc/postfix/inbound-access,permit_sasl_authenticated, permit_mynetworks, reject_unauth_destination
mailbox_size_limit = 25600000
transport_maps = hash:/etc/postfix/transport
message_size_limit = 20240000

virtual.pcre 和虛擬:

/(.*)@[^.]*\.example\.com$/ mailman

運輸:

# demo
.demo.example.com   smtp:192.168.100.161:25
# demo mail
demo.example.com    smtp:192.168.100.161
# Demo2
.demo2.example.com  smtp:192.168.100.221:25
# demo2 domain
demo2.example.com   smtp:192.168.100.221

我的網域:

localhost       OK
mail.local  OK
example.com     OK

答案1

首先,我不確定這是否有效,但我希望它能幫助您入門:

  1. 從 mydomains 中刪除 example.com,因為此 postfix 實例不會直接處理它的郵件。
  2. 添加virtual_alias_domains = .example.com此內容應該可以解決您的子網域問題
  3. 新增relay_domains = example.com並指定 example.com 的明確傳輸,例如:example.com :[exch11.hosted.com]

相關內容