|
  
- UID
- 1
- 帖子
- 263
- 精华
- 1
- 积分
- 62837
- 威望
- 218
- 金钱
- 125238
- 阅读权限
- 200
- 注册时间
- 2010-6-19
|
配置postfix使用远程smtp服务器relay邮件
一、服务器端允许指定客户端的relay
- #vi /etc/postfix/main.cf
- relay_domains = $mydestination
- mynetworks = 127.0.0.0/8, 1.2.3.4, 1.2.3.5
复制代码
说明:这里我们选择在mynetworks里面添加IP,而不是在relay_domains里添加域名,我们有很多站,而且都是在固定的几台服务器上的,所以使用这种方式更加便捷。
二、客户端配置
2.1 安装PLAIN,LOGIN验证机制接口软件包,用于向远程smtp服务器提供密码
- # yum -y install cyrus-sasl-plain
复制代码
2.2 配置postfix主文件
- #vi /etc/postfix/main.cf
- #进行tls加密连接
- smtp_use_tls = yes
- #启用sasl验证
- smtp_sasl_auth_enable = yes
- #中继服务器地址,不指定端口就是默认的tcp/25端口
- relayhost = [mail.libertyvps.com]:587
- #指定sasl验证文件路径
- smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
- #指定发件人,可以不设置
- #smtp_generic_maps=hash:/etc/postfix/generic
- #sasl验证的安全选项,这里设置为不允许明文验证和匿名用户登陆
- smtp_sasl_security_options = noplaintext, noanonymous
复制代码
2.3 sasl验证文件内容
- # cat /etc/postfix/sasl_passwd
- [mail.libertyvps.com]:587 username:password
复制代码
2.4 如果需要指定本地用户作为特定的远程用户来发送邮件
- # tail -n1 /etc/postfix/generic
- root@localhost username@libertyvps.com
复制代码
2.5 生成哈希表
- # postmap /etc/postfix/generic
- # postmap /etc/postfix/sasl_passwd
复制代码
2.6 启动服务
- # /etc/init.d/saslauthd start
- # service postfix restart
复制代码
=================美丽的分割线===============
补充:Gmail的可用smtp服务器地址
gmail-smtp.l.google.com
smtp.gmail.com |
|