Author: Christian K Date: To: exim-users Subject: Re: [exim] Finding Fallback DKIM Domain
Thanks for the ideas!
If someone needs it. This is what I came up with:
Get some list with all tlds and make sure the more specific ones are on top
(there is co.uk. and uk.)
% cat tld_list
*.com : com
*.co.uk : co\.uk
*.uk : uk
% exim -be '${sg{foo.bar.baz.co.uk} {^.*?([^\\.]+)\\.(${lookup {
foo.bar.baz.co.uk} wildlsearch{/path/to/tld_list}})\$} {\$1.\$2}}'
Replace foo.bar.baz.co.uk with what you want to replace, in my
case ${domain:$h_from:}. If there should be a be a weird tld case the tld
list is missing it should default to the entire domain which is quite
usable.
Any optimizations or feedback is welcome of course.