When exim4 sends HELO/EHLO, how do I configure which host name it sends?
Solution 1:
Assuming the error is complaining about the HELO/EHLO data, you want to use the helo_data option on the smtp transport. The default is $primary_hostname.
remote_smtp:
driver = smtp
helo_data = host.example.com
More information is available in the manual.
If this isn't the case, you probably want to include some example rejection messages. Just the three digit code and the string after that.
Solution 2:
The command
sudo dpkg-reconfigure exim4-config
should prompt you for the primary hostname to use.
Solution 3:
On Debian (Lenny) I found that you set hostname in /etc/hostname
but that this is not recognised until reboot.
$ hostname newhostname
sets it right away (but is lost on reboot, so you have to do the two).
exim4 seems to report the same as uname -n
, and I found that a useful way to test.
Solution 4:
Which hostname is exim sending ?
One can find the HELO name in exim4's logs. Stop the exim4 daemon, then restart it manually with debugging enabled :
/usr/sbin/exim4 -bd -d+all 2>&1 | egrep 'HELO|EHLO'
(the 2>&1|egrep 'HELO|EHLO'
part is optional, it just redirects stderr to stdout, then pipe the log to egrep
, which will filter everything but lines containing HELO or EHLO).
Send an email and there should be one or two lines in the following form :
SMTP>> EHLO foobar.example.com
The HELO name is foobar.example.com
.
There are also several useful online checking tools which provide this information (and many useful others), e.g. :
- https://www.mail-tester.com (beware, only 3 free email checks per day) ;
- [email protected] (free) ;
- [email protected] (most of its feedback is not free, but for this purpose it is).
How do I change it ?
Instead of editing the transport file as suggested by David, I'd rather use exim4 constant definitions (?) and set the name in /etc/exim4/conf.d/main/00_local_settings
(in split configuration), e.g. :
REMOTE_SMTP_HELO_DATA=$sender_address_domain
Don't forget to run update-exim4.conf
before to restart exim4.
I set primary_hostname […] in /etc/exim4/exim4.conf.template
As mentioned by David, this is probably not the best idea. In split configuration, you can set the primary hostname by adding
MAIN_HARDCODE_PRIMARY_HOSTNAME = subdomain.example.com
in /etc/exim4/conf.d/main/00_local_settings
. It seems it would be PRIMARY_HOST_NAME
in monolithic exim4 configuration.