diff options
| author | Barry Warsaw | 2008-03-27 05:14:14 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2008-03-27 05:14:14 -0400 |
| commit | 17f286de64cb3373d68c4fefba6d9369b4e3f960 (patch) | |
| tree | 5078531044f0574dfa340a389bd6d0bb9eea717f /mailman/queue/docs | |
| parent | de9deb660c5d48a083f0c56916cca6aa0cb010b3 (diff) | |
| download | mailman-17f286de64cb3373d68c4fefba6d9369b4e3f960.tar.gz mailman-17f286de64cb3373d68c4fefba6d9369b4e3f960.tar.zst mailman-17f286de64cb3373d68c4fefba6d9369b4e3f960.zip | |
Added a test of the OutgoingRunner, and subsequent changes to make it pass,
including:
- MailingList.full_path -> IMailingList.data_path and implement this as a
property on the MailingList object.
- Fix the 'decorate' handler to work with the new member/user data model,
instead of the old MemberAdaptor interface.
- Fix a few problems with the smtp-direct handler, though this needs more work
and tests.
- Add some debug logging to both the test smtplistener and the SMTPServer
proxy. Fix the proxy's consumption of messages from the thread queue.
- Fix the smtplistener's calculation of the X-Peer header.
Diffstat (limited to 'mailman/queue/docs')
| -rw-r--r-- | mailman/queue/docs/outgoing.txt | 96 |
1 files changed, 96 insertions, 0 deletions
diff --git a/mailman/queue/docs/outgoing.txt b/mailman/queue/docs/outgoing.txt new file mode 100644 index 000000000..fc9161320 --- /dev/null +++ b/mailman/queue/docs/outgoing.txt @@ -0,0 +1,96 @@ +Outgoing queue runner +===================== + +The outgoing queue runner is the process that delivers messages to the +directly upstream SMTP server. It is this external SMTP server that performs +final delivery to the intended recipients. + +Messages that appear in the outgoing queue are processed individually through +a 'delivery module', essentially a pluggable interface for determining how the +recipient set will be batched, whether messages will be personalized and +VERP'd, etc. The outgoing runner doesn't itself support retrying but it can +move messages to the 'retry queue' for handling delivery failures. + + >>> from mailman.app.lifecycle import create_list + >>> mlist = create_list(u'test@example.com') + + >>> from mailman.app.membership import add_member + >>> from mailman.interfaces import DeliveryMode + >>> add_member(mlist, u'aperson@example.com', u'Anne Person', + ... u'password', DeliveryMode.regular, u'en', + ... ack=False, admin_notif=False) + >>> add_member(mlist, u'bperson@example.com', u'Bart Person', + ... u'password', DeliveryMode.regular, u'en', + ... ack=False, admin_notif=False) + >>> add_member(mlist, u'cperson@example.com', u'Cris Person', + ... u'password', DeliveryMode.regular, u'en', + ... ack=False, admin_notif=False) + + >>> from mailman.tests.helpers import SMTPServer + >>> smtpd = SMTPServer() + >>> smtpd.start() + >>> from mailman.configuration import config + >>> old_host = config.SMTPHOST + >>> old_port = config.SMTPPORT + >>> config.SMTPHOST = smtpd.host + >>> config.SMTPPORT = smtpd.port + +By setting the mailing list to personalize messages, each recipient will get a +unique copy of the message, with certain headers tailored for that recipient. + + >>> from mailman.interfaces import Personalization + >>> mlist.personalize = Personalization.individual + >>> config.db.commit() + + >>> msg = message_from_string("""\ + ... From: aperson@example.com + ... To: test@example.com + ... Subject: My first post + ... Message-ID: <first> + ... + ... First post! + ... """) + +Normally, messages would show up in the outgoing queue after the message has +been processed by the rule set and pipeline. But we can simulate that here by +injecting a message directly into the outgoing queue. + + >>> msgdata = {} + >>> handler = config.handlers['calculate-recipients'] + >>> handler.process(mlist, msg, msgdata) + + >>> from mailman.queue import Switchboard + >>> outgoing_queue = Switchboard(config.OUTQUEUE_DIR) + >>> ignore = outgoing_queue.enqueue( + ... msg, msgdata, + ... verp=True, listname=mlist.fqdn_listname, tolist=True, + ... _plaintext=True) + +Running the outgoing queue runner processes the message, delivering it to the +upstream SMTP, which happens to be our test server. + + >>> from mailman.queue.outgoing import OutgoingRunner + >>> from mailman.tests.helpers import make_testable_runner + >>> outgoing = make_testable_runner(OutgoingRunner) + >>> outgoing.run() + +Three messages have been delivered to our SMTP server, one for each recipient. + + >>> from operator import itemgetter + >>> messages = sorted(smtpd.messages, key=itemgetter('sender')) + >>> len(messages) + 3 + + >>> for message in messages: + ... print message['sender'] + test-bounces+aperson=example.com@example.com + test-bounces+bperson=example.com@example.com + test-bounces+cperson=example.com@example.com + + +Clean up +-------- + + >>> smtpd.stop() + >>> config.SMTPHOST = old_host + >>> config.SMTPPORT = old_port |
