Incoming message have multiple adresses in the envelope-to
and to
headers. I want to discard all the original recipients and deliver that message to the special single address if some condition matches in ACL. How that can be done?
Incoming message have multiple adresses in the envelope-to
and to
headers. I want to discard all the original recipients and deliver that message to the special single address if some condition matches in ACL. How that can be done?
It sounds like what you want is to classify any email sent to your host directly from an IP in a dynamic range as spam, and feed those messages to SpamAssassin so it can learn the characteristics of those spam messages in case they come from "legitimate" servers.
If that is the case what you want to do can be accomplished without doing regex matches on the email's headers to isolate senders (computationally expensive!), and without rewriting emails (also computationally expensive, adding an extra step), by leveraging DNS blacklists.
(The Spamhaus PBL will have a list of "dyn-ip networks", and it is almost certainly more accurate & less time-consuming than a list you maintain by hand. Alternatively you could use the Zen list and catch lots of other stuff too)
pipe sa-learn
)fail
orfinish
it as you desire)I'm not an Exim expert, but from examining the documentation this whole chain can be assembled using exim filter files and a
dnsdb
lookup (in place of the built-in blacklist support).If you want to then add your regex matching as additional conditions you can certainly do that as well, but no recipient rewriting appears to be necessary.