On 08/18/2013 09:20 AM, VuNghia Truong wrote:
>
> Suppose that I have archive file, like "list_name.mbox".
> Now, I want to get the message with same "References" field, and send them
> out.
> How could I accomplish this problem?
from Mailman import Mailbox
mid = 'the message Id you're looking for'
fp = open('/path/to/list_name.mbox')
mb = Mailbox.Mailbox(fp)
msgs = []
for msg in mb:
refs = msg.get_all('references')
for ref in refs:
if ref.find(mid) >= 0:
msgs.append(msg)
break
# At this point, msgs contains a list of email.Message.Message objects #
that contain 'the message Id you're looking for' in their References:
# Sending them is left as an exercise for the reader.
--
Mark Sapiro <[email protected]> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
_______________________________________________
Mailman-Developers mailing list
[email protected]
https://mail.python.org/mailman/listinfo/mailman-developers
Mailman FAQ: http://wiki.list.org/x/AgA3
Searchable Archives:
http://www.mail-archive.com/mailman-developers%40python.org/
Unsubscribe:
https://mail.python.org/mailman/options/mailman-developers/archive%40jab.org
Security Policy: http://wiki.list.org/x/QIA9