Linux

如何在 debian 上設置 exim4 sender_helo_name

  • October 5, 2017

我在執行 debian 8.9 的 vps 上使用 exim4 郵件伺服器,問題是我可以收到電子郵件但無法發送郵件,所以當我從 roundcube 發送郵件到 gmail 時出現錯誤

SMTP 錯誤 (550):無法設置發件人(訪問被拒絕 - HELO 名稱無效(請參閱 RFC2821 4.1.3))。

所以我檢查了exim4模板並調試它,發現 $ sender_helo_name is set to my server ip address. so i was wondering how to set $ sender_helo_name 值到我的站點域

更新 exim 主日誌:

2017-09-28 09:33:56 H=localhost (198.50.220.183) [127.0.0.1] rejected MAIL <contactus@useotools.com>: Access denied - Invalid HELO name ( 198.50.220.183) (See RFC2821 4.1.3)
2017-09-28 09:36:23 no host name found for IP address 123.56.151.114
2017-09-28 09:36:24 no host name found for IP address 123.56.151.114
2017-09-28 09:39:01 1dxQbF-0003dy-6j <= root@useotools.com U=root P=local S=1044
2017-09-28 09:39:01 1dxQbF-0003dy-6j => root <root@useotools.com> R=localuser T=local_delivery
2017-09-28 09:39:01 1dxQbF-0003dy-6j Completed
2017-09-28 09:43:17 no IP address found for host 207-101-169-181.fibertel.com.ar (during SMTP connection from [181.169.101.207])
2017-09-28 09:43:18 no IP address found for host 207-101-169-181.fibertel.com.ar (during SMTP connection from [181.169.101.207])
2017-09-28 09:46:36 no IP address found for host ip-187.94.111-100.globalwave.com.br (during SMTP connection from [187.94.111.100])
2017-09-28 09:46:37 no IP address found for host ip-187.94.111-100.globalwave.com.br (during SMTP connection from [187.94.111.100])
2017-09-28 09:53:15 no host name found for IP address 41.191.224.5
2017-09-28 09:53:16 no host name found for IP address 41.191.224.5
2017-09-28 09:54:23 exim 4.84_2 daemon started: pid=15145, -q30m, listening for SMTP on port 25 (IPv4) port 587 (IPv4) port 2525 (IPv4) and for SMTPS on port 465 (IPv4)

定義宏 MAIN_HARDCODE_PRIMARY_HOSTNAME 並將其設置為所需的名稱。通常這將類似於 mail.example.com 或 smtp.example.com。如果您使用拆分配置,請使用/etc/exim4/conf.d/main. 否則,使用/etc/exim4/exim4.conf.localmacros.

接收伺服器正在發送 550 錯誤,表明您的 HELO 名稱無效。它應該設置為與伺服器 IP 地址的 PTR 記錄相同的值。要設置 PTR 記錄,您需要一個靜態 IP 地址和您的提供商的合作。您還需要一個對應的 A 記錄作為您的郵件伺服器的名稱。這將啟用名稱的 rDNS 驗證。您的 MX 記錄應指向此名稱。

另請查看為您的郵件伺服器和域設置 SPF 記錄。

使用您的 VPS 提供商的中繼伺服器可能是一個更簡單的解決方案。使用smarthost帶有本地郵件的配置。將中繼伺服器配置為智能主機伺服器。修改您的 SPF 記錄以指示中繼伺服器可以為您的域發送郵件。

引用自:https://serverfault.com/questions/875800