You can find all contacts who share a primary email with members of a group, and save those contacts to a Smart Group, using Civi's APIv4. This solution was developed on CiviCRM 5.32.2 and may not work on previous versions.

[Navigate to the API4 explorer](https://docs.civicrm.org/dev/en/latest/api/#api-explorer) within your Civi. Then configure a query as in the screenshot below, or paste the following into your URL bar after the word "explorer" and hit enter:

````
/GroupContact/get?join=[["Email AS contact_A_email",false,null,["contact_id","%3D","contact_A_email.contact_id"],["contact_A_email.id","%3D","contact_A_email.id"]],["Email AS contact_B_email",true,null,["contact_A_email.email","%3D","contact_B_email.email"],["contact_A_email.contact_id","<>","contact_B_email.contact_id"],["contact_B_email.id","%3D","contact_B_email.id"]]]&select=["contact_B_email.contact_id"]&where=[["group_id","%3D","18"],["status","%3D","Added"],["contact_A_email.is_primary","%3D","true"],["contact_B_email.is_primary","%3D","true"]]&limit=0&groupBy=["contact_B_email.contact_id"]
````

[![screenshot of API explorer with filled-in fields][1]][1]

Note you'll need to select your "donated recently" smart group where I have "Email List - CA" in the screenshot. Also, if you'd like to widen the search to include non-primary email addresses, just delete the "where" clauses that refer to "is_primary".

What this is doing is:

1. *GroupContact... get... Where group_id = x and status = added*: Search for members of a particular group (in this case, it'll be your "donated recently" group).
1. *Join Email AS contact_A_email*...: get those recent donors' email addresses.
1. *Join Email as contact_B_email*...: get email addresses that are the same as the ones we just found, but belong to different contacts.
1. *Select contact_B_email.contact_id*: return the contacts connected to those matching email addresses.

Once everything is set up, you can click the Save button and create your smart group. Once you have that, you should be able to exclude these contacts from mailings.

  [1]: https://i.sstatic.net/OW8sM.png

(P.S. There's a quirk about APIv4 which forces me to include the "x.id = x.id" clauses in the joins. I might even call it a bug -- so maybe it will be fixed in future versions.)