15

Mails from my system are being rejected when the receiving server does HELO checking. I believe my system is sending the wrong domain name. I'm running exim4. Googling for anything about exim4 and domains yields a nightmarish list of irrelevant results. Similarly, googling for HELO rejections yields a horde of outlook users who need to turn on SMTP authentication. I cannot for the life of me figure out this simple question: which hostname is exim sending and how do I change it?

Unfortunately, I can't watch what exim is sending over the wire, so I have no way to debug this myself. I'm hoping someone has had this problem and just knows :).

5 Answers5

18

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.

David Pashley
  • 23,151
  • 2
  • 41
  • 71
  • 1
    Thanks! After 10 more minutes of reading about how to even *change* an exim4 setting on a debian-based system, I set primary_hostname to the FQDN in /etc/exim4/exim4.conf.template and restarted exim4. That did the trick! My hostname is different from the FQDN and I am not using minimal_dns, thus the original problem. Plus, only by modifying your manual link was I able to even *find* the docs on primary_hostname (exim is so google-trashed!). Thanks again! –  Jun 19 '09 at 08:43
  • 1
    You probably don't want to update that file. I would recommend running update-exim4.conf --keepcomments and then copy /var/lib/exim4/config.autogenerated to /etc/exim4/exim4.conf and then modify that file. – David Pashley Jun 19 '09 at 13:19
4

The command

sudo dpkg-reconfigure exim4-config

should prompt you for the primary hostname to use.

David North
  • 762
  • 1
  • 5
  • 12
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) ;
  • check-auth@verifier.port25.com (free) ;
  • mailtest@unlocktheinbox.com (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.

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.

0

The setting you want is called primary_hostname.

For debugging you can use

tcpdump -A port 25

to watch SMTP traffic in ASCII.

brian-brazil
  • 3,904
  • 1
  • 20
  • 15