@@ -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.95 2002-10-07 00:52:51 richard Exp $
76+ $Id: mailgw.py,v 1.96 2002-10-15 06:51:32 richard Exp $
7777'''
7878
7979import string , re , os , mimetools , cStringIO , smtplib , socket , binascii , quopri
@@ -145,8 +145,15 @@ def __init__(self, instance, db):
145145
146146 def do_pipe (self ):
147147 ''' Read a message from standard input and pass it to the mail handler.
148+
149+ Read into an internal structure that we can seek on (in case
150+ there's an error).
151+
152+ XXX: we may want to read this into a temporary file instead...
148153 '''
149- self .main (sys .stdin )
154+ s = cStringIO .StringIO ()
155+ s .write (sys .stdin .read ())
156+ self .main (s )
150157 return 0
151158
152159 def do_mailbox (self , filename ):
@@ -337,8 +344,8 @@ def bounce_message(self, message, sendto, error,
337344 body = w .startbody (content_type )
338345 try :
339346 message .rewindbody ()
340- except IOError :
341- body .write ("*** couldn't include message body: read from pipe ***" )
347+ except IOError , message :
348+ body .write ("*** couldn't include message body: %s ***" % message )
342349 else :
343350 body .write (message .fp .read ())
344351
0 commit comments