From c0ee621cf3060daa7906b5fc66da6c43bf507490 Mon Sep 17 00:00:00 2001 From: richard Date: Tue, 13 Apr 2004 04:19:56 +0000 Subject: [PATCH] *** empty log message *** git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@2281 57a73879-2fb5-44c3-a270-3262357dd7e2 --- doc/index.txt | 1 + doc/installation.txt | 21 ++++++++++++++++++++- roundup/mailgw.py | 18 ++++++++---------- roundup/scripts/roundup_mailgw.py | 19 ++++++++++++------- 4 files changed, 41 insertions(+), 18 deletions(-) diff --git a/doc/index.txt b/doc/index.txt index c5d4355..6d77d59 100644 --- a/doc/index.txt +++ b/doc/index.txt @@ -98,6 +98,7 @@ Detlef Lannert, Andrey Lebedev, Henrik Levkowetz, Gordon McMillan, +John F Meinel Jr, Patrick Ohly, Luke Opperman, Will Partain, diff --git a/doc/installation.txt b/doc/installation.txt index 17573c1..4fada5d 100644 --- a/doc/installation.txt +++ b/doc/installation.txt @@ -2,7 +2,7 @@ Installing Roundup ================== -:Version: $Revision: 1.72 $ +:Version: $Revision: 1.73 $ .. contents:: @@ -418,6 +418,25 @@ submission user's POP account name, password and server. On windows, you would set up the command using the windows scheduler. +As a regular job using an IMAP source +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + +To retrieve from an IMAP mailbox, use a *cron* entry similar to the +POP one:: + + 0,10,20,30,40,50 * * * * /usr/local/bin/roundup-mailgw /opt/roundup/trackers/support imap + +where imap_spec is "``username:password@server``" that specifies the roundup +submission user's IMAP account name, password and server. You may +optionally include a mailbox to use other than the default ``INBOX`` with +"``imap username:password@server mailbox``". + +If you have a secure (ie. HTTPS) IMAP server then you may use ``imaps`` +in place of ``imap`` in the command to use a secure connection. + +As with the POP job, on windows, you would set up the command using the +windows scheduler. + UNIX Environment Steps ---------------------- diff --git a/roundup/mailgw.py b/roundup/mailgw.py index 35cc902..1435e03 100644 --- a/roundup/mailgw.py +++ b/roundup/mailgw.py @@ -74,7 +74,7 @@ are calling the create() method to create a new node). If an auditor raises an exception, the original message is bounced back to the sender with the explanatory message given in the exception. -$Id: mailgw.py,v 1.147 2004-04-13 04:11:06 richard Exp $ +$Id: mailgw.py,v 1.148 2004-04-13 04:16:36 richard Exp $ """ __docformat__ = 'restructuredtext' @@ -407,26 +407,24 @@ class MailGW: try: if not mailbox: - #print 'Using INBOX' (typ, data) = server.select() else: - #print 'Using mailbox' , mailbox (typ, data) = server.select(mailbox=mailbox) if typ != 'OK': - print 'Failed to get mailbox "%s": %s' % (mailbox, data) + print 'Failed to get mailbox "%s": %s'%(mailbox, data) return 1 try: numMessages = int(data[0]) - #print 'Found %s messages' % numMessages - except ValueError: - print 'Invalid return value from mailbox' + except ValueError, value: + print 'Invalid message count from mailbox %r'%data[0] return 1 for i in range(1, numMessages+1): - #print 'Processing message ', i (typ, data) = server.fetch(str(i), '(RFC822)') - #This marks the message as deleted. + + # mark the message as deleted. server.store(str(i), '+FLAGS', r'(\Deleted)') - #This is the raw text of the message + + # process the message s = cStringIO.StringIO(data[0][1]) s.seek(0) self.handle_Message(Message(s)) diff --git a/roundup/scripts/roundup_mailgw.py b/roundup/scripts/roundup_mailgw.py index 33633ad..d9b4bbf 100644 --- a/roundup/scripts/roundup_mailgw.py +++ b/roundup/scripts/roundup_mailgw.py @@ -14,7 +14,7 @@ # BASIS, AND THERE IS NO OBLIGATION WHATSOEVER TO PROVIDE MAINTENANCE, # SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. # -# $Id: roundup_mailgw.py,v 1.13 2004-04-13 04:11:06 richard Exp $ +# $Id: roundup_mailgw.py,v 1.14 2004-04-13 04:14:03 richard Exp $ """Command-line script stub that calls the roundup.mailgw. """ @@ -39,10 +39,11 @@ Options: -v: print version and exit -C / -S: see below -The roundup mail gateway may be called in one of three ways: +The roundup mail gateway may be called in one of four ways: . with an instance home as the only argument, . with both an instance home and a mail spool file, or - . with both an instance home and a pop server account. + . with both an instance home and a POP/APOP server account. + . with both an instance home and a IMAP/IMAPS server account. It also supports optional -C and -S arguments that allows you to set a fields for a class created by the roundup-mailgw. The default class if @@ -81,9 +82,11 @@ APOP: apop username:password@server IMAP: - Connect to an IMAP server. This supports the same notation as that of POP mail. + Connect to an IMAP server. This supports the same notation as that of + POP mail. imap username:password@server - It also allows you to specify a specific mailbox other than INBOX using this format: + It also allows you to specify a specific mailbox other than INBOX using + this format: imap username:password@server mailbox IMAPS: @@ -100,7 +103,8 @@ def main(argv): # take the argv array and parse it leaving the non-option # arguments in the args array. try: - optionsList, args = getopt.getopt(argv[1:], 'vC:S:', ['set=', 'class=']) + optionsList, args = getopt.getopt(argv[1:], 'vC:S:', ['set=', + 'class=']) except getopt.GetoptError: # print help information and exit: usage(argv) @@ -167,7 +171,8 @@ def main(argv): return handler.do_imap(m.group('server'), m.group('user'), m.group('pass'), mailbox, ssl) - return usage(argv, _('Error: The source must be either "mailbox", "pop" or "apop"')) + return usage(argv, _('Error: The source must be either "mailbox",' + ' "pop", "apop", "imap" or "imaps"')) finally: db.close() -- 2.30.2