On Fri, May 28, 1999 at 15:38:54 +0200, Attila Csosz wrote:
> I tried to mail me a test message with attachment( it contained a file
> test.arj ). Using mutt everythig is OK. I see in the attachment list the
> correct file name( pressing v key ). But when I fetched this mail with
> a windows based e-mail client( AKMail ) I see the attacment but the 
> attachment has no name.

There are two places where the file name of an attachment can
placed:

1) In the "Content-Type:"-header. This was defined in the now
obsolete RFC 1341, but the newer RFC 2046 says about this:

                            RFC 1341 also defined the use of a "NAME"
   parameter which gave a suggested file name to be used if the data
   were to be written to a file.  This has been deprecated in
   anticipation of a separate Content-Disposition header field, to be
   defined in a subsequent RFC.

2) In the "Content-Disposition:"-header according to RFC 2183.

Mutt understands both methods for storing the file name when
reading, but only uses the second method when generation new
attachments.

So if other e-mail clients cannot find the file name of attachments
made by mutt, it could be because they are too old to recognize the
Content-Disposition:-header.

It would not be hard to let mutt use both methods also when
writing, and I don't think that it would do any harm.

This patch should do it, but I haven't tested it!

--- sendlib.c.orig      Wed Apr 21 21:40:26 1999
+++ sendlib.c   Sat May 29 12:16:27 1999
@@ -423,15 +423,8 @@ int mutt_write_mime_header (BODY *a, FIL
     }
   }
 
-  fputc ('\n', f);
-
-  if (a->description)
-    fprintf(f, "Content-Description: %s\n", a->description);
-
   if (a->use_disp && (a->disposition == DISPATTACH || a->filename || a->d_filename))
   {
-    fprintf (f, "Content-Disposition: %s", DISPOSITION (a->disposition));
-
     if(!(fn = a->d_filename))
       fn = a->filename;
     
@@ -445,11 +438,20 @@ int mutt_write_mime_header (BODY *a, FIL
       
       buffer[0] = 0;
       rfc822_cat (buffer, sizeof (buffer), t, MimeSpecials);
-      fprintf (f, "; filename=%s", buffer);
-    }
 
-    fputc ('\n', f);
+      fprintf (f, "; name=%s\n"        /* Finish the Content-Type header */
+              "Content-Disposition: %s; filename=%s",
+              buffer, DISPOSITION (a->disposition), buffer);
+    }
+    else
+      fprintf (f, "\n"         /* Finish the Content-Type header */
+              "Content-Disposition: %s", DISPOSITION (a->disposition));
   }
+
+  fputc ('\n', f);
+
+  if (a->description)
+    fprintf(f, "Content-Description: %s\n", a->description);
 
   if (a->encoding != ENC7BIT)
     fprintf(f, "Content-Transfer-Encoding: %s\n", ENCODING (a->encoding));

-- 
Byrial

Reply via email to