如果 Postfix 中的本地邮件投递失败,我该如何将外发邮件发布到互联网上?
我的服务器已使用 mydomain.tld 配置虚拟域。当我向[电子邮件保护]它尝试在本地发送,如果找不到用户,则会失败。相反,我需要将这些邮件发布到互联网上。
上述要求的原因是我有多个配置了 mydomain.tld 的服务器。不同的用户位于不同的服务器中,但位于同一个域 - mydomain.tld(我有一个用于接收邮件的工作机制)
这是我的 main.cf 文件。
# postfix config file
# uncomment for debugging if needed
# soft_bounce=yes
# postfix main
mail_owner = postfix
setgid_group = postdrop
delay_warning_time = 4
# postfix paths
html_directory = no
command_directory = /usr/sbin
daemon_directory = /usr/lib/postfix
queue_directory = /var/spool/postfix
sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.2.2/samples
readme_directory = /usr/share/doc/postfix-2.2.2/README_FILES
# network settings
inet_interfaces = all
mydomain = mail1.mydomain.com
myhostname = mail1.mydomain.com
mynetworks = all
mydestination = localhost.$mydomain, localhost
#relay_domains = proxy:mysql:/etc/configs/postfix/mysql-relay_domains_maps.cf
# mail delivery
recipient_delimiter = +
# mappings
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
#transport_maps = hash:/etc/postfix/transport
#local_recipient_maps =
#local_transport = error:local mail delivery is disabled
# virtual setup
virtual_alias_maps = proxy:mysql:/etc/configs/postfix/mysql-virtual_alias_maps.cf,
regexp:/etc/configs/postfix/virtual_regexp
virtual_mailbox_base = /var/vmail
virtual_mailbox_domains = proxy:mysql:/etc/configs/postfix/mysql-virtual_domains_maps.cf
virtual_mailbox_maps = proxy:mysql:/etc/configs/postfix/mysql-virtual_mailbox_maps.cf
virtual_mailbox_limit_maps = proxy:mysql:/etc/configs/postfix/mysql-virtual_mailbox_limit_maps.cf
virtual_minimum_uid = 150
virtual_uid_maps = static:150
virtual_gid_maps = static:8
virtual_transport = dovecot
dovecot_destination_recipient_limit = 1
# debugging
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
# authentication
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
smtpd_sasl_local_domain = $myhostname
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
# tls config
smtp_use_tls = no
smtpd_use_tls = no
#smtp_tls_note_starttls_offer = yes
#smtpd_tls_loglevel = 1
#smtpd_tls_received_header = yes
#smtpd_tls_session_cache_timeout = 3600s
#tls_random_source = dev:/dev/urandom
#smtp_tls_session_cache_database = btree:$data_directory/smtp_tls_session_cache
# Change mail.example.com.* to your host name
#smtpd_tls_key_file = /etc/pki/tls/private/mail.example.com.key
#smtpd_tls_cert_file = /etc/pki/tls/certs/mail.example.com.crt
# smtpd_tls_CAfile = /etc/pki/tls/root.crt
# rules restrictions
smtpd_client_restrictions =
smtpd_helo_restrictions =
smtpd_sender_restrictions =
smtpd_recipient_restrictions = permit_sasl_authenticated,
permit_mynetworks,
reject_unauth_destination,
reject_non_fqdn_sender,
reject_non_fqdn_recipient,
reject_unknown_recipient_domain
# uncomment for realtime black list checks
# ,reject_rbl_client zen.spamhaus.org
# ,reject_rbl_client bl.spamcop.net
# ,reject_rbl_client dnsbl.sorbs.net
smtpd_helo_required = yes
unknown_local_recipient_reject_code = 550
disable_vrfy_command = yes
smtpd_data_restrictions = reject_unauth_pipelining
提前感谢您的任何回答。
答案1
我建议您删除所有 virtual_mailbox_* 参数并仅使用 transport_maps 和 reply_domains。
在 master.cf 中设置“dovecot:”传输,通过 dovecot LDA 或 dovecot LMTP 传递您的邮件。例如:
dovecot unix - n n - - pipe
flags=DRhu user=vmail:vmail argv=/usr/local/libexec/dovecot/dovecot-lda -f ${sender} -d ${recipient}
下一步操作是将 mydomain.tld 附加到您的relay_domains。
之后,为 transport_maps 配置一个 SQL 配置文件,以便为每个现有用户提供类似“dovecot:”的结果。否则,这里不返回任何内容。还使用以下条目为 transport_maps 创建哈希表:
mydomain.tld [other.mailserver.mydomain.tld]
最后一行是 mydomain.tld 的默认中继主机。任何匹配的电子邮件地址都会覆盖此默认地址,因此会发送到您的本地 dovecot 服务器。