I think we have not any solution yet, that exactly solves the initial problem. Therefore, I would like to provide a more explicit approach. Lets suppose, that our whitelist looks like this:
white.domain.tld light.domain.tld
Then I would try the following reciept:
:0 * !^From.*@white\.domain\.tld * !^From.*@light\.domain\.tld /dev/null
This would send all emails that are not from somebody@white.domain.tld and not from somebody@light.domain.tld to /dev/null
. The remaining emails are send to the default destination. Be aware to use \.
in your pattern if you like to match a single dot. The pattern .
matches a single character.
If you have a short whitelist, you could try to get an even shorter reciept by combining the patterns:
:0 * !^From.*@(white|light)\.domain\.tld /dev/null
Be aware to use ( )
here. Using [ ]
would be a mistake.