我希望通过我的个人Google帐户转发非本地电子邮件,并将其转发给本地用户.
我的配置是:
/等/后缀/运输
我的配置是:
/等/后缀/运输
* smtp:[smtp.gmail.com]:587
和/etc/postfix/main.cf
[root@media postfix]# cat main.cf # This file contains only the parameters changed from a default install # see /etc/postfix/main.cf.dist for a commented,fuller version of this file. transport_maps = hash:/etc/postfix/transport smtp_sasl_auth_enable = yes smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd smtp_sasl_mechanism_filter = plain,login smtp_sasl_security_options = noanonymous smtp_use_tls = yes
/等/后缀/ sasl_passwd:
[smtp.google.com]:587 myuser@gmail.com:mypass
在我跑完之后:
# postmap transport && postmap sasl_passwd systemctl restart postfix.service
所以现在我的服务器尝试连接到gmail MX(没有成功,但没有提供电子邮件localy
来自journalctl的日志:
Jul 06 18:38:01 media postfix/pickup[31431]: 30714960F8: uid=0 from=<root> Jul 06 18:38:01 media postfix/cleanup[31641]: 30714960F8: message- id=<20130706163801.30714960F8@media.localdomain> Jul 06 18:38:01 media postfix/qmgr[31432]: 30714960F8: from=<root@media.localdomain>,size=436,nrcpt=1 (queue active) Jul 06 18:38:01 media postfix/smtp[31643]: connect to smtp.gmail.com[2a00:1450:4008:c01::6c]:587: Network is unreachable Jul 06 18:38:01 media postfix/smtp[31643]: 30714960F8: to=<mackowiakp23@gmail.com>,relay=smtp.gmail.com[173.194.69.108]:587,delay=0.7,delays=0.03/0.04/0.55/0.07,...M command)) Jul 06 18:38:02 media postfix/cleanup[31641]: 0B85D960F9: message-id=<20130706163802.0B85D960F9@media.localdomain> Jul 06 18:38:02 media postfix/qmgr[31432]: 0B85D960F9: from=<>,size=2555,nrcpt=1 (queue active) Jul 06 18:38:02 media postfix/bounce[31646]: 30714960F8: sender non-delivery notification: 0B85D960F9 Jul 06 18:38:02 media postfix/qmgr[31432]: 30714960F8: removed Jul 06 18:38:02 media postfix/smtp[31643]: connect to smtp.gmail.com[2a00:1450:4008:c01::6d]:587: Network is unreachable Jul 06 18:38:02 media postfix/smtp[31643]: 0B85D960F9: to=<root@media.localdomain>,relay=smtp.gmail.com[173.194.69.109]:587,delay=0.59,delays=0.02/0.01/0.51/0.06,...M command)) Jul 06 18:38:02 media postfix/qmgr[31432]: 0B85D960F9: removed Jul 06 18:38:40 media auth[31778]: pam_tcb(dovecot:auth): Authentication passed for media from (uid=0) Jul 06 18:38:40 media dovecot[1442]: pop3-login: Login: user=<media>,method=PLAIN,rip=192.168.0.2,lip=192.168.0.7,mpid=31779,secured,session=<VZaXcdrgpADAqAAC> Jul 06 18:38:40 media dovecot[1442]: pop3(media): Disconnected: Logged out top=0/0,retr=0/0,del=0/0,size=0 Jul 06 18:38:58 media postfix/pickup[31431]: CD15D960F8: uid=0 from=<root> Jul 06 18:38:58 media postfix/cleanup[31641]: CD15D960F8: message-id=<20130706163858.CD15D960F8@media.localdomain> Jul 06 18:38:58 media postfix/qmgr[31432]: CD15D960F8: from=<root@media.localdomain>,size=430,nrcpt=1 (queue active) Jul 06 18:38:59 media postfix/smtp[31643]: CD15D960F8: to=<mackowiakp@op.pl>,delay=0.63,delays=0.02/0/0.54/0.06,dsn=5.5....M command)) Jul 06 18:38:59 media postfix/cleanup[31641]: BAB0E960F9: message-id=<20130706163859.BAB0E960F9@media.localdomain> Jul 06 18:38:59 media postfix/qmgr[31432]: BAB0E960F9: from=<>,size=2541,nrcpt=1 (queue active) Jul 06 18:38:59 media postfix/bounce[31646]: CD15D960F8: sender non-delivery notification: BAB0E960F9 Jul 06 18:38:59 media postfix/qmgr[31432]: CD15D960F8: removed Jul 06 18:39:00 media postfix/smtp[31643]: BAB0E960F9: to=<root@media.localdomain>,delay=0.66,delays=0.02/0.01/0.56/0.07,...M command)) Jul 06 18:39:00 media postfix/qmgr[31432]: BAB0E960F9: removed
有什么帮助使它工作?
解决方法
您必须在Postfix的SMTP客户端中启用TLS,因为Google需要它.在必须发出STARTTLS命令的消息中由它们指示.
在/etc/postfix/main.cf中,你想要这样的东西:
smtp_tls_policy_maps = hash:/ etc / postfix / tls_policy
然后在/ etc / postfix / tls_policy中:
[smtp.gmail.com]:587加密
tls_policy中的左侧必须与main.cf中的relayhost条目完全相同.
请记住在根据需要创建或更改后在/ etc / postfix / tls_policy上运行postmap.
您可以在Postfix的TLS文档中找到更多详细信息.
请参阅这些链接