@@ -73,7 +73,7 @@ class node. Any parts of other types are each stored in separate files
7373an exception, the original message is bounced back to the sender with the
7474explanatory message given in the exception.
7575
76- $Id: mailgw.py,v 1.52 2002-01-15 00:12:40 richard Exp $
76+ $Id: mailgw.py,v 1.53 2002-01-16 07:20:54 richard Exp $
7777'''
7878
7979
@@ -90,6 +90,9 @@ class MailGWError(ValueError):
9090class MailUsageError (ValueError ):
9191 pass
9292
93+ class MailUsageHelp (Exception ):
94+ pass
95+
9396class UnAuthorized (Exception ):
9497 """ Access denied """
9598
@@ -145,6 +148,15 @@ def handle_Message(self, message):
145148 if sendto :
146149 try :
147150 return self .handle_message (message )
151+ except MailUsageHelp :
152+ # bounce the message back to the sender with the usage message
153+ fulldoc = '\n ' .join (string .split (__doc__ , '\n ' )[2 :])
154+ sendto = [sendto [0 ][1 ]]
155+ m = ['' ]
156+ m .append ('\n \n Mail Gateway Help\n =================' )
157+ m .append (fulldoc )
158+ m = self .bounce_message (message , sendto , m ,
159+ subject = "Mail Gateway Help" )
148160 except MailUsageError , value :
149161 # bounce the message back to the sender with the usage message
150162 fulldoc = '\n ' .join (string .split (__doc__ , '\n ' )[2 :])
@@ -238,7 +250,7 @@ def bounce_message(self, message, sendto, error,
238250 # attach the original message to the returned message
239251 part = writer .nextpart ()
240252 part .addheader ('Content-Disposition' ,'attachment' )
241- part .addheader ('Content-Description' ,'Message that caused the error ' )
253+ part .addheader ('Content-Description' ,'Message you sent ' )
242254 part .addheader ('Content-Transfer-Encoding' , '7bit' )
243255 body = part .startbody ('message/rfc822' )
244256 body .write (m .getvalue ())
@@ -253,6 +265,10 @@ def handle_message(self, message):
253265 '''
254266 # handle the subject line
255267 subject = message .getheader ('subject' , '' )
268+
269+ if subject .strip () == 'help' :
270+ raise MailUsageHelp
271+
256272 m = subject_re .match (subject )
257273 if not m :
258274 raise MailUsageError , '''
@@ -731,6 +747,9 @@ def parseContent(content, blank_line=re.compile(r'[\r\n]+\s*[\r\n]+'),
731747
732748#
733749# $Log: not supported by cvs2svn $
750+ # Revision 1.52 2002/01/15 00:12:40 richard
751+ # #503340 ] creating issue with [asignedto=p.ohly]
752+ #
734753# Revision 1.51 2002/01/14 02:20:15 richard
735754# . changed all config accesses so they access either the instance or the
736755# config attriubute on the db. This means that all config is obtained from
0 commit comments