我需要将通过某个掩码转到邮箱的所有电子邮件转发到一个特定的邮箱。 例如,如果收件人邮件是79001234567它应该被转发。
从/etc/postfix/main.cf行
virtual_alias_maps = $alias_maps, $virtual_maps, ldap:/etc/postfix/imap-aliases.cf, ldap:/etc/postfix/imap-groups.cf, regexp:/etc/postfix/dummyregexp
这里是我使用的正则expression式:/ etc / postfix / dummymail
/^7\d{10}@domain.tld/ [email protected]
/ var / log / maillog的一部分
Mar 17 01:39:23 mail postfix/smtpd[24228]: connect from mail-qa0-f52.google.com[209.85.216.52] Mar 17 01:39:23 mail postfix/smtpd[24228]: setting up TLS connection from mail-qa0-f52.google.com[209.85.216.52] Mar 17 01:39:24 mail postfix/smtpd[24228]: Anonymous TLS connection established from mail-qa0-f52.google.com[209.85.216.52]: TL Sv1 with cipher RC4-SHA (128/128 bits) Mar 17 01:39:24 mail postfix/smtpd[24228]: NOQUEUE: reject: RCPT from mail-qa0-f52.google.com[209.85.216.52]: 550 5.1.1 <[email protected]>: Recipient address rejected: User unknown in local recipient table; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<mail-qa0-f52.google.com> Mar 17 01:39:25 mail postfix/smtpd[24228]: disconnect from mail-qa0-f52.google.com[209.85.216.52] Mar 17 01:39:57 mail imaps[23602]: accepted connection
另外,我尝试添加其他行到/ etc / postfix / dummymail,这个为我工作
/[email protected]/ [email protected]
所以我认为我的正则expression式有问题。
用POSIX字符类replace\d :
/^7[[:digit:]]{10}@domain.tld/ [email protected]