The following is the GNU All-permissive License as recommended in https://www.gnu.org/licenses/license-recommendations.en.html
Copyright (C) 2024 Free Software Foundation sysadmin@fsf.org
Copying and distribution of this file, with or without modification, are permitted in any medium without royalty provided the copyright notice and this notice are preserved. This file is offered as-is, without any warranty.
Contributions are welcome. See https://savannah.gnu.org/maintenance/fsf/.
To transition sending email to a new ip or range
Send a certain percent of messages on the new and old ip. To do this on one machine which has both ips,
add these to the remote smtp transports. For example, in /etc/exim4/conf.d/transports.conf
depending on the config setup.
helo_data = ${lookup dnsdb {ptr=$sending_ip_address}{$value}{$primary_hostname}}
interface = ${if < {${randint:1000}}{3} {209.51.188.17}{208.118.235.17}}
In this example the new ip is 209.51.188.17 and the old is 208.118.235.17 and this makes it send 3/1000 messages on the new ip.
Progression should be slowly increasing. We used this daily sequence change in the 2018/2019 change: 5 10 15 20 30 40 60 80 120 160 220 320 480 640 860 1000
For exim about 4.71 or earlier, the rng is bad or nonexistent, so use this instead.
interface = ${if <= {${run{/usr/bin/python -c "import random; import sys; sys.stdout.write(str(random.randint(1,1000)))"}}}{5} {209.51.188.13}{208.118.235.13}}
For testing on the normal mail servers, i did this config and test message:
interface = ${if eq {iankelling.org}{$domain} {209.51.188.13}{208.118.235.13}}
echo "test body" | mail -s "test mail from $HOSTNAME" ian@iankelling.org
and to verify the helo, i ran this
exim -d -t <<'EOF'
From: root@gnu.org
To: ian@iankelling.org
Subject: Testing Exim
This is a test message.
EOF
For testing config changes, run update-exim4.conf, which will affect subsequent runs of exim, for example when you send a test message, or when new queue runners are spawned, but it won't restart existing processes, thus it will have a less detrimental affect if things are wrong. There are better ways to test new configs where the new queue runner's won't pick it up, but I haven't figured it out yet. After a change is tested, restart exim.