On 3 Feb 2025 08:17 -0600, from m...@tim.thechases.com (Tim Chase): > I've been trying to come up with a way to create a filter for mail where > my wife is the only recipient, but having trouble crafting it. The aim > would be to craft a hook based on something like > > ~t sweethe...@example.org [magic here] > > pulling in a different (disgustingly smoochy) .signature for her if > she's the only recipient, but if anybody else is in the To: or CC: or > BCC: just use the default signature.
Maybe an anchored regular expression? Something along the lines of (largely untested) ~t ^([^;,]*<)?sweethe...@example.org(>[^;,]*)$ This should match only when there is only a single recipient (no ; or , separators) and the particular email address also matches (not any other email address). When it matches, set the smoochy signature. So it should handle the case of To: sweethe...@example.org and also To: My Dearest <sweethe...@example.org> but does not match on the older syntax of To: sweethe...@example.org (My Dearest) And have a separate `~t .` _preceding_ this rule to set the default signature. The matching does however get slightly more complicated because of the comma if you want to also handle the case of To: "Dearest, My" <sweethe...@example.org> Ultimately this is a case of which failure mode you prefer: sending an email with the smoochy signature to your manager at work, or sending an email with the default signature to your wife. Optimizing for the latter failure mode seems safer. :-) -- Michael Kjörling 🔗 https://michael.kjorling.se