gmail以root身份发送Postfix中继

我configuration了后缀来转发Gmail(谷歌应用程序),但电子邮件发送为[email protected]而不是[email protected](我相信)我已经configuration。 我认为configuration是好的,因为我没有得到任何错误。 问题是,它试图发送不存在的根! 我如何获得电子邮件作为[email protected]发送,如我在sasl_password文件和db中指定的?

对于所有的configuration/日志,我已经删除了我的域名,取而代之的是example.com。

Maillogs

Oct 1 13:40:57 mon1 postfix/qmgr[5449]: C01AD22880: from=<[email protected]>, size=450, nrcpt=1 (queue active) Oct 1 13:40:57 mon1 postfix/local[5456]: C01AD22880: to=<admin@domain>, relay=local, delay=0.05, delays=0.03/0.01/0/0.01, dsn=2.0.0, status=sent (delivered to mailbox) 

sasl_password

 [smtp.gmail.com]:587 [email protected]:MYPASSWORD 

/ etc / aliases(没有教程build议这个,只是我试过的一件事)

 #PostFix root: [email protected] 

添加到main.cf

 relayhost = [smtp.gmail.com]:587 # enable SASL authentication smtp_sasl_auth_enable = yes # disallow methods that allow anonymous authentication. smtp_sasl_security_options = noanonymous # where to find sasl_passwd smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd # Enable STARTTLS encryption smtp_use_tls = yes # where to find CA certificates smtp_tls_CAfile = /etc/ssl/certs/ca-bundle.trust.crt 

你可以使用sender_canonical_maps伪装发送邮件,在你的main.cf中

sender_canonical_maps = hash:/ etc / postfix / sender_canonical

 echo "root admin@mydomain" >> /etc/postfix/sender_canonical postmap /etc/postfix/sender_canonical 

之后,重新加载你的后缀服务