同一邮件服务器上托管的两个域之间的 Postfix 虚拟别名

同一邮件服务器上托管的两个域之间的 Postfix 虚拟别名

情况:我有两个域名:domain.pl 和 domain.com。我配置了两个电子邮件[电子邮件保护][电子邮件保护]。我也有仅在 ssl.domain.com 上有效的 SSL 证书。

问题:我想设置所有邮件从[电子邮件保护]=>[电子邮件保护](或者理想情况下,所有内容从@domain.com 到domain.pl)。

我做了什么:我使用了虚拟别名,两封邮件都正确发送了,但转发不起作用。我还尝试了recipient_bcc_maps技巧,但没有成功。我使用的是postfix 2.9.6。以下是我的配置文件:

主配置文件

# /etc/mailname => domain.com
myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
append_dot_mydomain = no
readme_directory = no
smtpd_tls_cert_file=/etc/postfix/keys/domain.crt
smtpd_tls_key_file=/etc/postfix/keys/domain.key
smtpd_tls_CAfile=/etc/postfix/keys/startssl.ca
smtpd_use_tls=yes
smtpd_tls_security_level=may
#smtpd_tls_auth_only=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

smtpd_delay_reject = yes
smtpd_helo_required = yes
smtpd_helo_restrictions = permit_mynetworks, reject_invalid_hostname, permit
smtpd_sender_restrictions = permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_sender, reject_unknown_sender_domain, permit
smtpd_recipient_restrictions = reject_unauth_pipelining, permit_sasl_authenticated, permit_mynetworks, reject_non_fqdn_recipient, reject_unknown_recipient_domain, reject_unauth_destination, reject_unknown_sender_domain, check_policy_service unix:private/policy-spf

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

dovecot_destination_recipient_limit = 1
local_recipient_maps =

myhostname = ssl.domain.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = localhost.localdomain, localhost
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
message_size_limit = 102400000
recipient_delimiter = +
inet_interfaces = all

# trick try, forwards contained:
# [email protected] [email protected]
#recipient_bcc_maps = hash:/etc/postfix/forwards

#DKIM
milter_default_action = accept
milter_protocol = 6
smtpd_milters = inet:localhost:12345
non_smtpd_milters = inet:localhost:12345

#VIRTUAL
virtual_transport = dovecot-spamass
virtual_mailbox_domains = domain.pl, domain.com
virtual_mailbox_maps = hash:/etc/postfix/vmailbox
virtual_alias_maps = hash:/etc/postfix/virtual

主配置文件

smtp      inet  n       -       -       -       -       smtpd
    -o receive_override_options=no_address_mappings
submission inet n       -       -       -       -       smtpd
pickup    fifo  n       -       -       60      1       pickup
cleanup   unix  n       -       -       -       0       cleanup
qmgr      fifo  n       -       n       300     1       qmgr
tlsmgr    unix  -       -       -       1000?   1       tlsmgr
rewrite   unix  -       -       -       -       -       trivial-rewrite
bounce    unix  -       -       -       -       0       bounce
defer     unix  -       -       -       -       0       bounce
trace     unix  -       -       -       -       0       bounce
verify    unix  -       -       -       -       1       verify
flush     unix  n       -       -       1000?   0       flush
proxymap  unix  -       -       n       -       -       proxymap
proxywrite unix -       -       n       -       1       proxymap
smtp      unix  -       -       -       -       -       smtp
relay     unix  -       -       -       -       -       smtp
    -o smtp_fallback_relay=
showq     unix  n       -       -       -       -       showq
error     unix  -       -       -       -       -       error
retry     unix  -       -       -       -       -       error
discard   unix  -       -       -       -       -       discard
local     unix  -       n       n       -       -       local
virtual   unix  -       n       n       -       -       virtual
lmtp      unix  -       -       -       -       -       lmtp
anvil     unix  -       -       -       -       1       anvil
scache    unix  -       -       -       -       1       scache

maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/bin/maildrop -d ${user}@${domain} ${extension} ${recipient} ${user} ${nexthop}

uucp      unix  -       n       n       -       -       pipe
  flags=Fqhu user=uucp argv=uux -r -n -z -a$sender - $nexthop!rmail ($recipient)

ifmail    unix  -       n       n       -       -       pipe
  flags=F user=ftn argv=/usr/lib/ifmail/ifmail -r $nexthop ($recipient)
bsmtp     unix  -       n       n       -       -       pipe
  flags=Fq. user=bsmtp argv=/usr/lib/bsmtp/bsmtp -t$nexthop -f$sender $recipient
scalemail-backend unix  -   n   n   -   2   pipe
  flags=R user=scalemail argv=/usr/lib/scalemail/bin/scalemail-store ${nexthop} ${user} ${extension}
mailman   unix  -       n       n       -       -       pipe
  flags=FR user=list argv=/usr/lib/mailman/bin/postfix-to-mailman.py
  ${nexthop} ${user}

dovecot   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

dovecot-spamass   unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail:vmail argv=/usr/bin/spamc -u ${recipient} -e /usr/lib/dovecot/deliver -f ${sender} -d ${recipient}

policy-spf  unix  -  n  n  -  -  spawn user=nobody argv=/usr/bin/policyd-spf

虚拟邮箱

[email protected] whatever
[email protected] whatever

虚拟的

@domain.com [email protected]
@domain.pl [email protected]

别名

mailer-daemon: postmaster
postmaster: root
nobody: root
hostmaster: root
usenet: root
news: root
webmaster: root
www: root
ftp: root
abuse: root
noc: root
security: root
root: tom

以下是输出发送邮件[电子邮件保护]

This is the mail system at host ssl.domain.com.

Enclosed is the mail delivery report that you requested.

                   The mail system

<[email protected]> (expanded from <[email protected]>): delivery via
    dovecot-spamass: delivers to command: /usr/bin/spamc


Reporting-MTA: dns; ssl.domain.com
X-Postfix-Queue-ID: D23E242559
X-Postfix-Sender: rfc822; [email protected]
Arrival-Date: Tue, 11 Feb 2014 02:54:16 +0000 (UTC)

Final-Recipient: rfc822; [email protected]
Original-Recipient: rfc822; [email protected]
Action: deliverable
Status: 2.0.0
Diagnostic-Code: X-Postfix; delivery via dovecot-spamass: delivers to command:
    /usr/bin/spamc


Return-Path: <[email protected]>
Received: by ssl.domain.com (Postfix, from userid 0)
    id D23E242559; Tue, 11 Feb 2014 02:54:16 +0000 (UTC)
X-DKIM: OpenDKIM Filter v2.6.8 ssl.domain.com D23E242559
DKIM-Signature: ......
From: [email protected]
Subject: probe
To: [email protected]
Message-Id: <[email protected]>
Date: Tue, 11 Feb 2014 02:54:16 +0000 (UTC)

我现在真的没有主意了,任何帮助我都会非常感激。我有一种不好的感觉,我错过了一些非常简单的东西......

答案1

您可以插入 /etc/aliases

jerry: [email protected],[email protected]
tom: [email protected],[email protected]

您将收到所有电子邮件。

相关内容