Index: req-mail
===================================================================
RCS file: /cvsroot/its/sw/wreq/req-mail,v
retrieving revision 1.4
retrieving revision 1.6
diff -u -w -u -r1.4 -r1.6
--- req-mail	1999/05/15 10:41:24	1.4
+++ req-mail	1999/05/15 11:12:45	1.6
@@ -51,6 +51,7 @@
 @body=();
 $body='';  # as description field in req
 $date='';
+$mimetype=''; # If this a mime message, place the type here
 $warn=''; # error message. if set, no auto reply will be sent to sender
 # carry along the group name if given as the 1st arg to the alias:
 $group=defined($ARGV[0])?$ARGV[0]:''; 
@@ -69,7 +70,11 @@
 }
 
 $header=join "\n",@header;
-$body=join "\n",@body;
+
+if (grep(/^MIME-Version: /, @header)) {
+	my ($typeline) = grep(/^Content-Type: /i, @header);
+	($mimetype) = $typeline =~ m/Content-Type:\s+([^;]+)/i;
+}
 
 ###parse header for email:
 foreach (@header){
@@ -79,6 +84,8 @@
 	###########################################################
 	}elsif(/^Date:\s+(.*\S)/){ # Date: a b
 		$date=$1;
+	}elsif(/^Subject:\s+(.*\S)/){ # Subject: line
+		$subject=$1;
 	}
 	###########################################################
 }
@@ -139,6 +146,31 @@
 if($uid =~ /^(root|diag|sys|adm|lp|nobody|MAILER-DAEMON|postmaster|\
 daemon|bin|uucp|powerdown)/i){
 	#$warn.=" Not send auto-reply to uid $uid."; 
+}
+
+# XXX Should parse/unpack MIME mail here.  We only handle text/plain for now.
+if ($mimetype && 'text/plain' ne $mimetype) {
+	# send error back to user
+	&sendMail("$error_from", "", "$email", "",
+		  "Error in sending your request",
+	  "Your request with subject\n\n$subject\n\n" .
+	  "was NOT included in bug list!\n\n".
+	  "We only handle MIME type text/plain or non-MIME for the moment\n" .
+	  "Please resend your request like that, or use the web form.\n\n" .
+	  "Thank you\n");
+	exit 0;
+}
+
+# Skip signature
+if ('' eq $mimetype || 'text/plain' eq $mimetype) {
+    $bodylines = 0;
+    foreach (@body) {    
+	last if (/^-- $/);
+	$bodylines++;
+    }
+    $body=join "\n",@body[0..$bodylines-1];
+} else {
+    $body=join "\n",@body;
 }
 
 ###send the request to the web server
