From 67e437883d520bf7ea78ae55235892aa946ef0b4 Mon Sep 17 00:00:00 2001 From: Barry Warsaw Date: Sat, 26 Apr 2008 01:57:53 -0400 Subject: Handle commands in the body of a plain text email message. --- mailman/queue/docs/command.txt | 45 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) (limited to 'mailman/queue/docs') diff --git a/mailman/queue/docs/command.txt b/mailman/queue/docs/command.txt index 5168dda07..fdad3bb5c 100644 --- a/mailman/queue/docs/command.txt +++ b/mailman/queue/docs/command.txt @@ -9,6 +9,10 @@ message is sent to the list's -request address. >>> from mailman.app.lifecycle import create_list >>> mlist = create_list(u'test@example.com') + +A command in the Subject +------------------------ + For example, the 'echo' command simply echoes the original command back to the sender. The command can be in the Subject header. @@ -59,3 +63,44 @@ And now the response is in the virgin queue. [..., ('listname', u'test@example.com'), ..., ('recips', [u'aperson@example.com']), ...] + + +A command in the body +--------------------- + +The command can also be found in the body of the message, as long as the +message is plain text. + + >>> msg = message_from_string("""\ + ... From: bperson@example.com + ... To: test-request@example.com + ... Message-ID: + ... + ... echo foo bar + ... """) + + >>> inject_message(mlist, msg, qdir=config.CMDQUEUE_DIR) + >>> command.run() + >>> len(virgin_queue.files) + 1 + >>> item = get_queue_messages(virgin_queue)[0] + >>> print item.msg.as_string() + Subject: The results of your email commands + From: test-bounces@example.com + To: bperson@example.com + ... + Precedence: bulk + + The results of your email command are provided below. + + - Original message details: + From: bperson@example.com + Subject: n/a + Date: ... + Message-ID: + + - Results: + echo foo bar + + - Done. + -- cgit v1.2.3-70-g09d2