[MlMt] check whether a recipient is in a certain group?

Shoshanna Green shoshannag at gmail.com
Tue Feb 23 11:10:31 EST 2016


Just to close the loop on this one: I originally asked, back in July 
2015, whether it was possible to maintain a list of approved addresses 
and have MailMate check whether any recipient of an outgoing message 
from a particular account is *not* in that list. (Sample use case: let's 
not accidentally email a new work contact from the address I use for 
World of Warcraft.) Using this with a group set up in Contacts.app would 
be ideal, but it's a bluesky feature for MailMate, so I asked Benny for 
help. And after many travails, mostly documented in the thread under 
this subject line, I got it more or less working!

Keeping the list of approved addresses in the body of a dummy email 
message did not work at all; MailMate didn't seem able to see the 
contents of the message. (Although if there was only one address in the 
list, it sometimes did seem to work. Things got very complicated.)

Keeping the list in the BCC line of a dummy draft email message didn't 
work, because the BCC addresses were lost every time the draft was 
saved. (Or maybe when MailMate was restarted. It's been a while.)

Keeping the list in the subject line of a dummy draft message didn't 
work, because MailMate didn't seem to be able to see it there, either.

But keeping the list of approved addresses in the TO line of a dummy 
draft message *does* work! The condition

"(from ~[c] 'problematic.address at example.com' and #recipient.address 
!=[c] 
$'imap://problematic.address@imap.example.com/list-of-addresses'.#recipient.address)"

properly triggers when a message is about to be sent from 
"problematic.address at example.com" to any address that is not in the TO 
line of a dummy draft message in an IMAP folder titled 
"list-of-addresses" in the problematic.address account.

Of course, the new risk is that I might accidentally send that dummy 
message, with its (currently) hundred-and-thirty-odd recipient addresses 
all visible. So I've added another verification condition to hopefully 
prevent that, should my fingers and my attention ever slip that badly. 
And the list of approved addresses isn't as easy to maintain as a list 
in the email body would be, just because a TO line that long is hard to 
see; I have it mirrored in a text file for easier access.

But it WORKS. Yay!

Shoshanna Green
shoshannag at gmail.com


More information about the mailmate mailing list