[Mailman-Users] Any easy way to remove one email address fromaqueued message?

Mark Sapiro msapiro at value.net
Thu Apr 27 06:03:21 CEST 2006


Sam Cannell wrote:
>
>I'd prefer to do it this way, however I haven't really worked much with
>that side of mailman.  I've looked around the mailman site for
>information about the classes and functions I have access to through
>withlist, but haven't had a lot of luck.  Is there any documentation
>like this online?


You want to do this under withlist just to provide the proper
environment for the unpickling. In my previous message I suggested
calling the process() function in SMTPDirect.py as a posibility, but I
think that may not work because SMTPDirect expects to be called from
OutgoingRunner. Anyway, I did a little test as follows:

[msapiro at msapiro ~]$ bin/withlist list1
Loading list list1 (unlocked)
The variable `m' is the list1 MailList instance
>>> import pickle
>>> fp = open('path/to/queue/entry.pck','rb')
>>> msg = pickle.load(fp)
>>> msgdata = pickle.load(fp)
>>> fp.close()
>>> msgdata['recips']
['msapiro at mail.value.net']

You may or may not want to do this as the list may be large

At this point you probably want to do something like

r = msgdata['recips']
del r[r.index("'the at bad.one'")]
msgdata['recips'] = r

Then write it to a new pickle:

>>> fp = open('path/to/new/entry.pck','wb')
>>> pickle.dump(msg, fp)
>>> pickle.dump(msgdata, fp)
>>> fp.close()
>>>                    (control-D here to quit)
Finalizing
[msapiro at msapiro ~]$

At this point, you may want to check with show_qfiles or dumpdb to see
that the new entry looks right. You could diff the outputs of dumpdb
applied to both pickle files to see that only the recips list changed.

Ultimately, you want to give the new file the same name as the old (the
name consists of a time and a hash and should be the right format),
and then move it to the out queue and Mailman will do the rest.

-- 
Mark Sapiro <msapiro at value.net>       The highway is for gamblers,
San Francisco Bay Area, California    better use your sense - B. Dylan




More information about the Mailman-Users mailing list