Extract Domains from Email Using Exim

Written 7 years ago by Mike Cardwell

I’ve recently found myself down-sizing my server hosting in order to save money. Because I now have a much lower spec server to run my email service from, I need to drop SpamAssassin from my configuration; it simply uses up too much of my available memory. However, SpamAssassin does a number of useful things, one of which is extracting the domain names from URLs in the message body of an email, then looking them up against RHSBLs, such as the SpamHaus DBL, URIBL and SURBL. There is no built in option for Exim to do this on its own.

In searching for a solution, I came across Erik Mugele‘s exim_surbl application. It’s an embedded Perl script which you can call from Exim, which extracts the domains and then does lookups against URIBL and SURBL. It can be used to search the entire message, and also individual MIME parts.

Eriks script is useful, but it doesn’t support the SpamHaus DBL without making some changes. It also does too much. There is no need for the script to perform the lookups as Exim can do that part it’s self. I wanted a script which would simply extract the domains, pass them to Exim, and then let Exim do what it wants with them.

So I wrote one.

It’s released under the GPL so you’re free to download, modify and distribute it. You can read the instructions and download it from here.

Looking to hire somebody like me? I'm open to offers of full time employment and small contract jobs. Check out my hiring page. You can follow this Blog using RSS or . To read more, visit my blog index.

Feeling generous?BitcoinMoneroZcashPaypal