Centos

Postfix 配置 - 子域和域的不同伺服器

  • July 19, 2012

我有以下設置: 1 個後綴伺服器:a.example.com需要接受 example.com 上任何子域的所有電子郵件*@*.example.com*@example.com1 個託管交換:exch11.hosted.com例如.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。任何人都可以幫助我或指出我正確的方向嗎?

歡迎任何幫助。

謝謝。

main.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. 從 mydomains 中刪除 example.com,因為這個 postfix 實例不直接為它處理郵件。
  2. 添加virtual_alias_domains = .example.com這應該可以解決您的子域問題
  3. 為 example.com添加relay_domains = example.com並指定顯式傳輸,例如:example.com :[exch11.hosted.com]

引用自:https://unix.stackexchange.com/questions/43288