Seems a little hard to implement.
The blacklists might be IP address or network, sender domain, sender email address, wildcard email address, etc. Hard to match.
At a quick glance, a simple implementation would require loading the blacklist into an array then checking to see if the email address, host ip, or sender domain is in that array. However, from the way you are speaking, there may be other items needing to be matched?
This is currently a bit of a big problem for me. We receive thousands of legit emails from a handful of vendors, that clog up our logs, and it is very hard to find sort through the list to find others that should be whitelisted or blacklisted.
Not sure how to do this in PHP, but in perl:
if (($senderEmail ~~ @blacklist) || ($senderHostIP ~~ @blacklist) ||($senderFromDomain ~~ @blacklist) || )
## entry is in the list do not do anything
## print entry to screen
## Then do the same for whitelist.