kon*_*nqi 7 postfix google-compute-engine google-cloud-platform g-suite
将 postfix 设置为使用 Google Apps SMTP 中继的 SMTP 中继的步骤是什么。网上有很多教程解释了如何将smtp.gmail.com
网关与 SASL 身份验证一起使用,但我找不到此处smtp-relay.google.com
描述的 Google Apps 中继的工作配置,尤其是特定于 Google Compute 的配置。
我已经按照此处所述使用“仅我的域中的地址”设置了 smtp 中继服务,并验证了 IP 实际上是我连接的 IP。
我知道,谷歌计算不允许端口25的输出端口的描述在这里。
我正在使用 debian linux 或 debian 衍生产品。
我已经按照文档中的详细说明设置了 postfix,但我在 mail.log 中得到的只是:
postfix/smtp[720]: send attr reason = host smtp-relay.gmail.com[66.102.1.28] said:
550-5.7.1 Invalid credentials for relay [104.155.78.1]. The IP address you've
550-5.7.1 registered in Google Apps SMTP Relay service doesn't match domain of
550-5.7.1 the accountthis email is being sent from. If you are trying to relay
550-5.7.1 mail from a domain that isn't registered under your Googles Apps
550-5.7.1 account or has empty envelope-from, you must configure your mail
550-5.7.1 server either to use SMTP AUTH to identify the sending domain or to
550-5.7.1 present one of your domain names in the HELO or EHLO command. For
550-5.7.1 more information, please visit
550 5.7.1 https://support.google.com/a/answer/6140680#invalidcred kg2sm505213wjb.4 - gsmtp (in reply to MAIL FROM command)
Run Code Online (Sandbox Code Playgroud)
安装后缀 apt-get install postfix
。当被问到选择“卫星系统”或带有智能主机的选项时。暂时接受其他所有内容的默认值。
根据以下文件编辑 main.cf:
/etc/postfix/main.cf
# a file which should contain the google apps domain
myorigin = /etc/mailname
# if your google apps domain is in mydestination, remove it, or postfix will attempt to deliver your mail locally
mydestination = ...., localhost
# Google Apps Relay SMTP, must use Port 587 because, 25 is blocked
relayhost = [smtp-relay.gmail.com]:587
# Force ehlo behavior
smtp_always_send_ehlo = yes
smtp_helo_name = <yourappsdomainhere>
# Enable TLS
smtp_use_tls=yes
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
# limit smtp to loopback interface & compute engine doesn't support ipv6
inet_interfaces = loopback-only
inet_protocols = ipv4
# These lines can be used, if the result is not as expected
# debug_peer_list = smtp-relay.gmail.com
# debug_peer_level = 2
Run Code Online (Sandbox Code Playgroud)
用service postfix restart
. 一切都应该很好。
这可能不是所有解决方案中最干净的,但它对我有用。
归档时间: |
|
查看次数: |
16845 次 |
最近记录: |