PHP Classes

Semicolon in attachment filename

Recommend this page to a friend!

      PHP MIME Email Message Parser  >  All threads  >  Semicolon in attachment filename  >  (Un) Subscribe thread alerts  
Subject:Semicolon in attachment filename
Summary:Parser fails if the attachment filename contains a semicolon
Messages:4
Author:Jamin
Date:2008-07-09 17:25:16
Update:2008-07-16 01:59:23
 

  1. Semicolon in attachment filename   Reply   Report abuse  
Picture of Jamin Jamin - 2008-07-09 17:25:16
We've had this problem show up recently, where our clients are scanning a document and emailing it to us - however, their scanner software is naming the file something like "07-07-2008 05;18;41PM.jpg".

The full part header of that particular file looks like this:

------=_NextPart_000_0001_01C8E055.ECCBCB80
Content-Type: image/jpeg;
name="07-07-2008 05;18;41PM.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: attachment;
filename="07-07-2008 05;18;41PM.jpg"

In an older version of your class file (which is excellent, by the way!), several notice-level errors were thrown when it encountered these files (Uninitialized string offset: 0 in lines 745 and 370). I updated to the newest class file, and it's at least no longer throwing errors. However, it's still dropping everything after the first semicolon, so the filename after parsing is just "07-07-2008 05". This is causing problems with some other things I've got going on in the app, because it can't find the "jpg" at the end and is unsure how to handle the file.

I realize that semicolons are "special" in headers, and probably shouldn't be part of the filenames in the first place. But is there possibly a workaround to this, so that we can still get it to go through fine?

Thanks in advance!

  2. Re: Semicolon in attachment filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-07-09 17:45:45 - In reply to message 1 from Jamin
Can you provide a minimal but complete sample message that I can use to reproduce the problem?

  3. Re: Semicolon in attachment filename   Reply   Report abuse  
Picture of Jamin Jamin - 2008-07-09 18:07:44 - In reply to message 2 from Manuel Lemos
Here ya go. Thanks again.



Return-path: <[email protected]>
Envelope-to: [email protected]
Delivery-date: Wed, 09 Jul 2008 12:57:56 -0500
Received: from [111.111.111.111] (helo=[222.222.222.222])
by host.test.com with esmtpa (Exim 4.69)
(envelope-from <[email protected]>)
id 1KGdvQ-0001aA-Iv
for [email protected]; Wed, 09 Jul 2008 12:57:56 -0500
Message-ID: <[email protected]>
Date: Wed, 09 Jul 2008 12:53:51 -0500
From: Test User <[email protected]>
User-Agent: Thunderbird 2.0.0.14 (Windows/20080421)
MIME-Version: 1.0
To: [email protected]
Subject: Test
Content-Type: multipart/mixed;
boundary="------------030708080709080301050704"

This is a multi-part message in MIME format.
--------------030708080709080301050704
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

Test

--------------030708080709080301050704
Content-Type: image/jpeg;
name="test;file.jpg"
Content-Transfer-Encoding: base64
Content-Disposition: inline;
filename="test;file.jpg"

/9j/4AAQSkZJRgABAgAAZABkAAD/7AARRHVja3kAAQAEAAAAPAAA/+4ADkFkb2JlAGTAAAAA
Af/bAIQABgQEBAUEBgUFBgkGBQYJCwgGBggLDAoKCwoKDBAMDAwMDAwQDA4PEA8ODBMTFBQT
ExwbGxscHx8fHx8fHx8fHwEHBwcNDA0YEBAYGhURFRofHx8fHx8fHx8fHx8fHx8fHx8fHx8f
Hx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8fHx8f/8AAEQgAEAAQAwERAAIRAQMRAf/EAG8AAQEA
AAAAAAAAAAAAAAAAAAQIAQABBQAAAAAAAAAAAAAAAAACAQMEBQYQAQEAAAQGAQUAAAAAAAAA
AAIBERIDBAAhMRMUBUFRYZEyBhEBAAIBAwUAAwAAAAAAAAAAARECAwAhMUFRYRIEIjIF/9oA
DAMBAAIRAxEAPwChfc+6panco0o7pgB9tKlZG6sTcCseUv56cZf7vtyZLtaT61U/Gd42Va78
iAPl8WGHCAd9G9N/RvyhotpaLc00Ws9mdZAirUuap5W9L8dOB/n/AH5aZCl/b1Y/aeu2zbfl
Ble55PN841U58abvNHd+v3b3Gnt/J27qUhC1LM9zI0iJ/tjZYb9OJmXFl+bI3pX2paXq8s9J
eVhB5h01W1clQWE0babPfe09ppbzX2/i7XRoWCC07e2s5JLheOeG1IyYcp9kw4Mv0ZTJkPWt
eDfvPWGZCWDiNFe9cdGoyuv/2Q==
--------------030708080709080301050704--

  4. Re: Semicolon in attachment filename   Reply   Report abuse  
Picture of Manuel Lemos Manuel Lemos - 2008-07-16 01:59:23 - In reply to message 3 from Jamin
Ok, I have fixed the bug and uploaded a fixed version. Thank you for reporting.