I have over the last days tried to setup Exim4 to handle all mails sent from a web application.

It seems to be working, but I haven't found out how to hardcode the hostname which will be sent with EHLO? (I don't want to set /etc/hostname)

Have found the variable MAIN_HARDCODE_PRIMARY_HOSTNAME mentioned in the config but havn't found a way to set it. Is this variable the simplest way to set the hostname or is there a better way to do it?

Below is the complete install/config.. Am I missing something?

Exim version 4.92 Debian Buster 10


apt-get install exim4-daemon-light

Configure Exim4

dpkg-reconfigure exim4-config

Type:           internet site
FQDN:           smtp.mydomain.com
SMTP listener:      (empty)
Mail destinations:  (empty)
Domain relay:       (empty)
Machine relay:      (empty)
DNS queries minimal:    No
Delivery method:    Maildir
Split conf files:   No

Enable TLS and generate certs

printf "MAIN_TLS_ENABLE = true\n" >> /etc/exim4/exim4.conf.localmacros

check reverse DNS (IP -> smtp.mydomain.com)


Get IPv6

ip -6 addr | grep inet6 | awk -F '[ \t]+|/' '{print $3}' | grep -v ^::1 | grep -v ^fe80


[ipv4]  smtp.mydomain.com
[ipv6]  smtp.mydomain.com

uncomment in '/etc/exim4/exim4.conf.template'

# plain_server:
# driver = plaintext
# public_name = PLAIN
# server_condition = "${if crypteq{$3}{${extract{1}{:}{${lookup{$2}lsearch{CON$
# server_set_id = $2
# server_prompts = :
# server_advertise_condition = ${if eq{$tls_cipher}{}{}{*}}
# .endif

add user/pass -> '/etc/exim4/passwd'



I have setup DKIM keys on the server and DKIM/SPF on DNS and both works


Set REMOTE_SMTP_HELO_DATA = whatever.you.want in /etc/exim4/exim4.conf.localmacros. It's supported by the Debian package since 4.69-10. From /usr/share/doc/exim4/changelog.Debian.gz:

  • Allow setting outgoing smtp helo/ehlo by setting REMOTE_SMTP_HELO_DATA macro directly. Previously this was just supposed to be used as a helper macro for REMOTE_SMTP_HELO_FROM_DNS. REMOTE_SMTP_HELO_FROM_DNS overrides a manual REMOTE_SMTP_HELO_DATA data setting. Closes: #514113

This macro is used by the Debian configuration template to populate the helo_data SMTP transport option.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.