If you list some okaddr's, ifvalidto will use them in place of $RECIPIENT. It exits 100 if none of them are listed in any recipients header fields.
For example, you can put
|ifvalidto
|./Maildir/
into your .qmail file to ignore all mails with a SMTP envelope address targeting you, but you are not a recipient according to the To, Cc, or Bcc information given.
Alternative, you may want to bounce the mail:
|bouncesaying 'mail not delivered' except ifvalidto
|./Maildir/
Or, you may apply a particular spam-catch address:
|condredirect $LOCAL-spam except ifvalidto
|./Maildir/
WARNING: ifvalidto will potentially disregard any mails originating from mailing lists. However, including your email address together with the usual 'To:' addresss of the mailing list allows you to overcome this situation.