![从我的本地邮件服务器发送邮件到 Gmail](https://linux22.com/image/1329214/%E4%BB%8E%E6%88%91%E7%9A%84%E6%9C%AC%E5%9C%B0%E9%82%AE%E4%BB%B6%E6%9C%8D%E5%8A%A1%E5%99%A8%E5%8F%91%E9%80%81%E9%82%AE%E4%BB%B6%E5%88%B0%20Gmail.png)
我刚刚配置了一个邮件服务器,并尝试使用我使用邮件服务器 DNS 创建的本地电子邮件向我的 gmail 帐户发送邮件。结果并不顺利。我使用 Redhat 服务器和 sendmail,并使用 evolution mail 进行测试。
我遇到了以下错误:
"RCPT TO<[email protected]> failed: <[email protected]>...
relaying temporarily denied. Cannot resolve PTR for my IP"
我该如何解决这个问题?
答案1
我很久以前就自己组装了它,现在尝试一下,看看它是否仍然有效。在终端窗口中,输入:
sudo aptitude install postfix libsasl2 ca-certificates mailx
sudo gedit /etc/postfix/main.cf
然后添加/更改此内容main.cf
:
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no
append_dot_mydomain = no
readme_directory = no
relayhost = [smtp.gmail.com]:587
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
smtp_sasl_auth_enable = yes
smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
smtp_sasl_security_options = noanonymous
smtp_sasl_tls_security_options = noanonymous
smtp_tls_note_starttls_offer = yes
tls_random_source = dev:/dev/urandom
smtp_tls_scert_verifydepth = 5
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtp_tls_CAfile = /etc/postfix/cacert.pem
smtpd_use_tls=yes
smtp_use_tls = yes
smtpd_tls_ask_ccert = yes
smtpd_tls_req_ccert =no
smtp_tls_enforce_peername = no
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
编辑/etc/postfix/sasl_passwd
以设置您的用户名和密码:
sudo gedit /etc/postfix/sasl_passwd
[smtp.gmail.com]:587 [email protected]:password
然后做:
sudo chmod 400 /etc/postfix/sasl_passwd
sudo postmap /etc/postfix/sasl_passwd
cat /etc/ssl/certs/Thawte_Premium_Server_CA.pem | sudo tee -a /etc/postfix/cacert.pem
sudo /etc/init.d/postfix restart