|
有时候公司在基于安全性的情况下需要将公司邮件服务器中的邮件通过另一台外围边缘邮件服务器发送出去,而不是直接用公司内部邮件服务器
这里采用的是Centos 6.3下postfix通过中继转发到Exchange发送邮件,这方面的资料在网上很少,不过很多是做Postfix>
此次试验只是做到postfix> 1.实验环境:
Postfix已安装完成且可用
Exchange邮件服务器已安装完成且可用
2.配置Postfix
添加如下几行到postfix配置文件中
# vi /etc/postfix/main.cf
relayhost = mail.example.com:25
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps =hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_use_tls = yes
smtpd_client_restrictions = permit_sasl_authenticated,reject #发送方需要经过认证,没经过认证的拒绝
设置sasl_passwd文件
# vi /etc/postfix/sasl_passwd 添加Exchange SMTP服务器域名、端口、认证账号密码
[mail.example.com]:25 wemux@example.com:password 修改sasl_passwd权限
# chmod 400 /etc/postfix/sasl_passwd
# postmap /etc/postfix/sasl_passwd #生成sasl_passwd.db文件
开启sasl验证服务
service saslauthd start #启动sasl验证功能
chkconfig saslauthd on #设置为开机自动启动
至此postfix这边的工作就做完了
3.设置Exchange服务器
新建接受连接器接受postfix发来的中继转发请求
设置接受连接器名称以及接受连接器类型
设置接受从postfix server发送来的邮件
创建完成之后对连接器做进一步设置,打开postfix>
勾选“Exchange Servers”复选框
至此,Exchange这边的设置也做完了,接下来的就是测试
4.测试
使用postfix发送邮件
# echo "this is test mail!" | mail -s "test mail> 查看实时日志的情况
# tail -f /var/log/maillog
May 21 11:18:51 Mail01 postfix/pickup[30090]: 39392E023D: uid=0 from=<root>
May 21 11:18:51 Mail01 postfix/cleanup[30105]: 39392E023D:message-id=<20130521031851.39392E023D@mail.example.com>
May 21 11:18:51 Mail01 postfix/qmgr[30091]: 39392E023D: from=<root@postfix.com>,size=467, nrcpt=1 (queue active)
May 21 11:18:51 Mail01 postfix/smtp[30110]: warning: mail.example.com[202.105.***.***]:25 offerednull AUTH mechanism list
May 21 11:19:21 Mail01 postfix/smtp[30110]: 39392E023D: to=<457922962@qq.com>,relay=mail.example.com[202.105.***.***]:25, delay=31,delays=0.03/0.02/0.08/30, dsn=2.6.0, status=sent (250 2.6.0<20130521031851.39392E023D@mail.example.com> [InternalId=297745]Queued mail for delivery)
May 21 11:19:21 Mail01 postfix/qmgr[30091]: 39392E023D: removed
可以查看到邮件已经从postfix发出去
到Exchange上查看邮件发送记录
再到我的个人邮箱查看收信情况
从postfix中继转发到exchange这个问题我也研究了有一段时间,现在终于搞定了,之后就是有关优化这方面的问题。 |
|
|