On Dec 29, 2012, at 06:01 PM, Sandesh Agrawal wrote:
I have trying to inject many messages into lmtp queue using :
./bin/mailman inject abc@xyz.com -f message_file -q lmtp
But whenever i see the number of messages using:
from mailman.testing.helpers import get_queue_messages items = get_queue_messages('lmtp') len(items)
it always display 1 , and on executing :
print items[0].msg.as_string()
only the latest message is being displayed, where are other older messages going ?
A few things could be happening, but first, this isn't really the right way to get messages into the system. The lmtp runner isn't a queue runner, meaning it does not wake up periodically to scan files in var/queue/lmtp. This runner is really just a daemon process. The fact that it creates such a directory is a bug, which I've now filed (LP: 1095422).
If you really want to inject messages into the system by way of the LMTP
runner, use Python's smtplib module and connect to the running daemon (started
by bin/mailman start
) with an smtplib.LMTP() instance.
Even so, I injected two copies of the following test message, and I ended up with two .pck files in var/queue/lmtp as expected. Then the get_queue_messages('lmtp') dequeued them both and returned a length-2 list of items.
Don't forget you can always just ls -lR var/queue
to see what's actually
there.
Cheers, -Barry