summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b69e2ee)
raw | patch | inline | side by side (parent: b69e2ee)
author | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 15 Oct 2002 07:25:49 +0000 (07:25 +0000) | ||
committer | richard <richard@57a73879-2fb5-44c3-a270-3262357dd7e2> | |
Tue, 15 Oct 2002 07:25:49 +0000 (07:25 +0000) |
git-svn-id: http://svn.roundup-tracker.org/svnroot/roundup/trunk@1354 57a73879-2fb5-44c3-a270-3262357dd7e2
roundup/mailgw.py | patch | blob | history |
diff --git a/roundup/mailgw.py b/roundup/mailgw.py
index 887f5238b9d2af3c3e44b0de704256e62180e705..90dca340e6fdb3168fb143294853e21b97c8cd60 100644 (file)
--- a/roundup/mailgw.py
+++ b/roundup/mailgw.py
an exception, the original message is bounced back to the sender with the
explanatory message given in the exception.
-$Id: mailgw.py,v 1.96 2002-10-15 06:51:32 richard Exp $
+$Id: mailgw.py,v 1.97 2002-10-15 07:25:49 richard Exp $
'''
import string, re, os, mimetools, cStringIO, smtplib, socket, binascii, quopri
'''
s = cStringIO.StringIO()
s.write(sys.stdin.read())
+ s.seek(0)
self.main(s)
return 0
body = part.startbody('text/plain')
body.write('\n'.join(error))
- # reconstruct the original message
- m = cStringIO.StringIO()
- w = MimeWriter.MimeWriter(m)
- # default the content_type, just in case...
- content_type = 'text/plain'
- # add the headers except the content-type
+ # attach the original message to the returned message
+ part = writer.nextpart()
+ part.addheader('Content-Disposition','attachment')
+ part.addheader('Content-Description','Message you sent')
+ body = part.startbody('text/plain')
for header in message.headers:
- header_name = header.split(':')[0]
- if header_name.lower() == 'content-type':
- content_type = message.getheader(header_name)
- elif message.getheader(header_name):
- w.addheader(header_name, message.getheader(header_name))
- # now attach the message body
- body = w.startbody(content_type)
+ body.write(header)
+ body.write('\n')
try:
message.rewindbody()
except IOError, message:
else:
body.write(message.fp.read())
- # attach the original message to the returned message
- part = writer.nextpart()
- part.addheader('Content-Disposition','attachment')
- part.addheader('Content-Description','Message you sent')
- part.addheader('Content-Transfer-Encoding', '7bit')
- body = part.startbody('message/rfc822')
- body.write(m.getvalue())
-
writer.lastpart()
return msg