Update of /cvsroot/tmda/tmda/TMDA
In directory usw-pr-cvs1:/tmp/cvs-serv17210/TMDA

Modified Files:
        AutoResponse.py 
Log Message:
When auto responding with a multipart/mixed message, add a
Content-Description header field to each bodypart.  From RFC 2045:

8.  Content-Description Header Field

   The ability to associate some descriptive information with a given
   body is often desirable.  For example, it may be useful to mark an
   "image" body as "a picture of the Space Shuttle Endeavor."  Such text
   may be placed in the Content-Description header field.  This header
   field is always optional.

     description := "Content-Description" ":" *text

   The description is presumed to be given in the US-ASCII character
   set, although the mechanism specified in RFC 2047 may be used for
   non-US-ASCII Content-Description values.


Index: AutoResponse.py
===================================================================
RCS file: /cvsroot/tmda/tmda/TMDA/AutoResponse.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- AutoResponse.py     19 Oct 2002 01:29:35 -0000      1.2
+++ AutoResponse.py     21 Oct 2002 19:10:29 -0000      1.3
@@ -98,7 +98,8 @@
         """
         # Headers that users shouldn't be setting in their templates.
         bad_headers = ['MIME-Version', 'Content-Type', 'BodyCharset',
-                       'Content-Transfer-Encoding', 'Content-Disposition']
+                       'Content-Transfer-Encoding', 'Content-Disposition',
+                       'Content-Description']
         for h in bad_headers:
             if self.bouncemsg.has_key(h):
                 del self.bouncemsg[h]
@@ -111,12 +112,19 @@
         elif bodyparts > 1:
             # A multipart/mixed entity with two bodyparts.
             self.mimemsg = MIMEMultipart('mixed')
+            if self.responsetype == 'request':
+                textpart['Content-Description'] = 'Confirmation Request'
+            elif self.responsetype == 'accept':
+                textpart['Content-Description'] = 'Confirmation Acceptance'
+            elif self.responsetype == 'bounce':
+                textpart['Content-Description'] = 'Failure Notice'
             self.mimemsg.attach(textpart)
             if Defaults.AUTORESPONSE_INCLUDE_SENDER_COPY == 1:
                 # include the headers only as a text/rfc822-headers part.
                 rfc822part = MIMEText(self.msgin_as_string,
                                       'rfc822-headers',
                                       self.msgin.get_charsets()[0])
+                rfc822part['Content-Description'] = 'Original Message Headers'
             elif Defaults.AUTORESPONSE_INCLUDE_SENDER_COPY == 2:
                 # include the entire message as a message/rfc822 part.
                 # don't include the payload if it's over a certain size.
@@ -126,6 +134,7 @@
                                   % Defaults.CONFIRM_MAX_MESSAGE_SIZE
                     self.msgin.set_payload(new_payload)
                 rfc822part = MIMEMessage(self.msgin)
+                rfc822part['Content-Description'] = 'Original Message'
             self.mimemsg.attach(rfc822part)
         # fold the template headers into the main entity.
         for k, v in self.bouncemsg.items():

_______________________________________
tmda-cvs mailing list
http://tmda.net/lists/listinfo/tmda-cvs

Reply via email to