I’ve recently changed my network connection at home to a provider which assigns dynamic addresses. Exim always provided a broken HELO/EHLO name to my smarthost since then because my externally visible hostname changes each time I connect. I’m now using Exim’s Perl interface to lookup the assigned hostname when connecting my smarthost:
#! /usr/bin/perl
# Requires libio-interface-perl
use strict;
use IO::Socket;
use IO::Interface;
sub get_remote_helo_data()
{
my $s = IO::Socket::INET->new(Proto => 'udp');
my $addr = inet_aton($s->if_addr('ppp0'));
my $hostname = gethostbyaddr($addr, AF_INET);
$hostname = '' if (!$hostname);
return $hostname;
}
#main/50_exim4-localconfig_perl
perl_at_start = true
perl_startup = do '/etc/exim4/exim.pl'
helo_data = \
${if >{${strlen:${perl{get_remote_helo_data}}}}{0} \
{${perl{get_remote_helo_data}}} \
{$primary_hostname}}