I have a Debian 11 docker container in which sendmail v. 8.15.2 is installed as MTA. Unfortunately spamhaus.org blacklisted the host IP due to the HELO header of mails being sent from this container is containing the local IP adress of the docker container. The message is:
{Host IP} is making SMTP connections with HELO values that use a bare IP address.
Following other answers here I tried to add the following to /etc/mail/sendmail.mc:
define(`confDOMAIN_NAME', `my-domain.example.com')dnl
define(`confHELO_NAME', `my-domain.example.com')dnl
and then
m4 sendmail.mc > sendmail.cf
service sendmail restart
which converts this to
Djmy-domain.example.com
O HeloName=my-domain.example.com
in sendmail.cf
. But to no avail, when sending a test mail I still get
echo "Subject: sendmail test" | sendmail -v -f "[email protected]" [email protected]
…
050 250-STARTTLS
050 250 Ok
050 >>> STARTTLS
050 220 Ready to start TLS
050 >>> EHLO 10.0.1.248
…
I then found out that I also should add the desired sender domain to /etc/mail/local-host-names
(restarting sendmail service again), but that also doesn't seem to change anything. Same as adding the domain name to /etc/hosts
as an alternative loopback
127.0.1.1 my-domain.example.com
or adding the domain to /etc/mailname
.
Could anyone point me to a solution?
I solved this problem by adding the domain as the hostname in my docker file like this:
This also takes care of the HELO/ELHO header in sendmail.