根据需求发送到邮箱service@test.com邮件转发到kf@test.com,并且发送到邮箱kf@test.com也能收到邮件
添加一个本地用户kf
kf:x:2011:2011::/var/spool/postfix/kf:/bin/bash本地linux系统中有个用户service,为它设置一个别名,是kf
root@linux:mail#vim /etc/aliasesservice: kf
还必须编辑/etc/postfix/main.cf文件
alias_maps = hash:/etc/aliases -->用来指定含有用户别名定义的文件路径,alias_database用来指定别名表数据库文件路径.alias_database = hash:/etc/aliases -->用来指定别名表数据库文件路径.注意配置文件中等号前后一定要有空格.
修改完配置文件后要使其生效,使用下面的命令
root@linux:mail# postalias /etc/aliasesroot@linux:mail# postfix reloadpostfix/postfix-script: refreshing the Postfix mail systempostalias命令用来将文件/etc/aliases生成postfix可以读取的数据库文件 /etc/aliases.db
下面我从163邮箱发送邮件到kf@test.com测试
root@linux:mail# pwd/var/spool/mailroot@linux:mail# tail -f kfFrom: daveTo: "kf@61.com" Subject: testX-Priority: 3X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20121107(20462.5035.5036) Copyright (c) 2002-2012 www.mailtech.cn 163comX-CM-CTRLDATA: b1dKUWZvb3Rlcl9odG09ODY6ODE=Content-Type: multipart/alternative; boundary="----=_Part_207345_818730686.1354877240624"MIME-Version: 1.0Message-ID: <42bc7ca5.dc84.13b74fa0530.Coremail.hechenmail163@163.com>X-CM-TRANSID:icGowEDJK0I5ycFQ5MQCAA--.2475WX-CM-SenderInfo: xkhfxvpqpdxzqrwtqiywtou0bp/1tbisBd+EE9o4ByE7QABs6X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU==------=_Part_207345_818730686.1354877240624Content-Type: text/plain; charset=GBKContent-Transfer-Encoding: 7bittest------=_Part_207345_818730686.1354877240624Content-Type: text/html; charset=GBKContent-Transfer-Encoding: 7bit test------=_Part_207345_818730686.1354877240624--
下面我从163邮箱发送邮件到service@test.com测试
root@linux:mail# pwd/var/spool/mailroot@linux:mail# tail -f kfFrom: daveTo: "service@test.com" Subject: aaaaaaaaaaaaX-Priority: 3X-Mailer: Coremail Webmail Server Version SP_ntes V3.5 build 20121107(20462.5035.5036) Copyright (c) 2002-2012 www.mailtech.cn 163comX-CM-CTRLDATA: /BRoT2Zvb3Rlcl9odG09OTY6ODE=Content-Type: multipart/alternative; boundary="----=_Part_208943_889274004.1354878154594"MIME-Version: 1.0Message-ID: <450a4fa3.de38.13b7507f763.Coremail.davemail163@163.com>X-CM-TRANSID:icGowEDpS0LKzMFQXMcCAA--.16656WX-CM-SenderInfo: xkhfxvpqpdxzqrwtqiywtou0bp/1tbisBd+EE9o4ByE7QADs4X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU==------=_Part_208943_889274004.1354878154594Content-Type: text/plain; charset=GBKContent-Transfer-Encoding: 7bitaaaaaaaaaaaaaa------=_Part_208943_889274004.1354878154594Content-Type: text/html; charset=GBKContent-Transfer-Encoding: 7bit aaaaaaaaaaaaaa------=_Part_208943_889274004.1354878154594--