用postfix架设海外邮件转发服务器

第一步,先在本地服务器创建要转发的域名,在main.cf 里加入

transport_maps  = hash:/etc/postfix/relay_maps

在/etc/postfix/relay_maps 输入下面的内容

yiyou.org  smtp:relay.yiyou.org

#  其中,前面部分为要转发的域名,后面是要转到的服务器

执行

postmap /etc/postfix/relay_maps

生成db 文件,重启postfix

第二步,配置relay 服务器,只把postfix 关键部分贴上来

smtpd_recipient_restrictions = permit_mynetworks,  permit_sasl_authenticated,  reject_unauth_destination,  reject_unauth_pipelining,  reject_invalid_hostname

mynetworks = hash:/etc/postfix/network_table

其中/etc/postfix/network_table 内容如下

127.0.0.0/8 OK
111.111.11.11 OK

要防止转发邮件,邮件日志

发信服务器

Dec  8 11:37:22 mail postfix/smtp[26775]: 69B352F276E: to=<fy@yiyou.org>, relay=relay.yiyou.org[111.111.11.2111]:25, delay=1.1, delays=0.05/0/0.7/0.31, dsn=2.0.0, status=sent (250 2.0.0 Ok: queued as 66892C8B2)

转发服务器

Dec 8 11:36:00 li408-244 postfix/smtpd[16806]: connect from mail.xxxxx.com[11.111.11.11]
Dec 8 11:36:00 li408-244 postfix/smtpd[16806]: 66892C8B2: client=mail.xxxxx.com[11.111.111.11]
Dec 8 11:36:00 li408-244 postfix/cleanup[16810]: 66892C8B2: message-id=<e73ba4d88a6b622d7ccf29a3fc6f174a@xxxx.com>
Dec 8 11:36:00 li408-244 postfix/qmgr[16774]: 66892C8B2: from=<fy@xxxxx.com>, size=925, nrcpt=1 (queue active)
Dec 8 11:36:00 li408-244 postfix/smtpd[16806]: disconnect from mail.xxxxx.com[11.115.111.11]
Dec 8 11:36:03 li408-244 postfix/smtp[16811]: 66892C8B2: to=<fy@yiyou.org>, relay=mxdomain.qq.com[183.60.62.12]:25, delay=2.8, delays=0.16/0.01/0.71/1.9, dsn=2.0.0, status=sent (250 Ok: queued as )
Dec 8 11:36:03 li408-244 postfix/qmgr[16774]: 66892C8B2: removed