如果您的ISP阻止端口25(这显然很频繁,对我来说也是如此),您可以使用Gmail作为中继.以下说明来自
here,并逐步介绍该过程:
在/etc/postfix/main.cf中添加:
# Relaying Postfix SMTP via GMAIL
relayhost = [smtp.gmail.com]:587
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtp_use_tls = yes
然后,您需要设置Gmail凭据.对于这个打开/创建/ etc / postfix / sasl_passwd并写:
[smtp.gmail.com]:587 USERNAME@gmail.com:PASSWORD
你在哪里(你可能已经猜到了)USERNAME和PASSWORD是你的凭据.然后更改文件的权限:
$sudo chmod 400 /etc/postfix/sasl_passwd
$sudo postmap /etc/postfix/sasl_passwd
现在我们需要将证书添加到Postfix:
$cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
只需重新启动postfix,你应该是好的:
$sudo service postfix restart
如果你想测试:
$echo "Hello World" | mail -s "Test Message" you@example.com
并检查邮件日志对它的看法:
$tail /var/log/mail.log
注意:每天只有500封电子邮件,使用Gmail的SMTP服务器作为中继.