# Extract Domains from Email Using Exim
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](https://spamassassin.apache.org/ "SpamAssassin Project
Home page") 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](https://www.spamhaus.org/dbl/ "SpamHaus DBL
Description"), [URIBL](https://uribl.com/ "URIBL Home page") and
[SURBL](https://www.surbl.org/ "SURBL Home page"). There is no built in option
for Exim to do this on its own.
In searching for a solution, I came across [Erik
Mugele](https://www.teuton.org/~ejm "Erik Mugele")'s
[exim_surbl](https://www.teuton.org/~ejm/exim_surbl/ "Exim Surbl Script")
application. It's an embedded [Perl](https://perl.org/ "Perl Home page") 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](/projects/EximExtractDomains).