Menu

#145 MIME Encoding of attachments flawed

closed-fixed
nobody
5
2002-02-09
2001-12-20
No

The Content-Type: line isn't encoded when sending MIME-
attached enclosures. In this case, the first line
after the separator should have read:

Content-Type: text/plain;

What was seen is as follows, extracted from message:
-----

--NextPart2a23005b1fadade4388314e3834d99eb
Content-Type: ;
name="Frunlog.txt"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="Frunlog.txt"

Discussion

  • Daniel Senie

    Daniel Senie - 2001-12-20

    Logged In: YES
    user_id=282992

    More info on this:

    The copy() function is supposed to get the MIME type from
    the browser. If the browser doesn't offer this information,
    the mime type is encoded as blank, which really screws up
    some mail reading programs (and probably violates the RFCs).

    I patched in some code to force the type to text/plain if
    the mime type is blank just to prove that's the problem,
    and now need to figure out the best way to do my own check
    of mime type so that send.php can encode it itself if the
    browser didn't volunteer the info.

     
  • Daniel Senie

    Daniel Senie - 2001-12-21

    Logged In: YES
    user_id=282992

    I've got a "fix" implemented, which probably would be a
    good addition regardless. I added the following:

    if ($mail_att_type == "") {
    $mail_att_type = trim(`file -b $tmpdir/$tmp_name`);
    }

    just before $mail_att_type is stuffed into the attachment
    array. This will provide a reasonable MIME type to encode
    in the event the browser didn't supply that information.

    Even though the browser IS supposed to send the info, it's
    better to add this code, since if the browser fails to
    provide the info the result had been malformed MIME.

     
  • Daniel Senie

    Daniel Senie - 2001-12-21

    Logged In: YES
    user_id=282992

    I've got a "fix" implemented, which probably would be a
    good addition regardless. I added the following:

    if ($mail_att_type == "") {
    $mail_att_type = trim(`file -b $tmpdir/$tmp_name`);
    }

    just before $mail_att_type is stuffed into the attachment
    array. This will provide a reasonable MIME type to encode
    in the event the browser didn't supply that information.

    Even though the browser IS supposed to send the info, it's
    better to add this code, since if the browser fails to
    provide the info the result had been malformed MIME.

     
  • Daniel Senie

    Daniel Senie - 2001-12-26

    Logged In: YES
    user_id=282992

    Well, it turns out the PHP 4.0.3 is_uploaded_file() has
    bugs. The version included with NOCC is ALSO flawed, or
    uses the same flawed underpinnings.

    The Content-Type: stuff isn't getting stripped from the
    uploaded attachment, thus rendering the attachment useless
    ot the recipient, and also is not getting the mime type
    moved into the proper return value.

     
  • Ross Golder

    Ross Golder - 2002-02-09
    • status: open --> closed-fixed
     
  • Ross Golder

    Ross Golder - 2002-02-09

    Logged In: YES
    user_id=20872

    I've added this fix to CVS.

     

Log in to post a comment.

MongoDB Logo MongoDB