match_recipients() utility function
Status: Alpha
Brought to you by:
gward
From an elspy-users post by Andrew Kuchling:
I've found the following function handy for checking if
a given recipient is
present in the envelope-to. Perhaps it's a candidate
for the elspy library?
Examples:
To reject all mail which is addressed to
spamtrap@example.com.
if match_recipients(info.recipients_list,
'spamtrap', 'example.com'):
raise RejectMessage("Spam not wanted here")
To allow only 'barb' and 'amk' local parts:
info.recipients_list =
match_recipients(info.recipients_list,
['barb', 'amk'],
'example.com')
--amk
Logged In: YES
user_id=14422
Superficial reactions:
* can't this be done in an ACL?
* is a regex really needed?