|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #68275 Mailparse breaks with certain malformed emails
Submitted: 2014-10-21 13:58 UTC Modified: -
Avg. Score:3.0 ± 0.7
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: niko at designosis dot com Assigned:
Status: Open Package: mailparse (PECL)
PHP Version: 5.4.34 OS: Centos
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2014-10-21 13:58 UTC] niko at designosis dot com
I just tested Mailparse on ~1 million emails. Just under 1% fail to be parsed correctly. For example, the following email sent from Swedish Microsoft Windows Live (2009):

From Tue Oct 21 15:36:14 2014
Received: from ([]:46745)
	by with esmtp (Exim 4.82)
	(envelope-from <>)
	id 1XgZbh-0006gK-4R
	for; Tue, 21 Oct 2014 15:36:14 +0200
Received: from acerDator ( by ( (authenticated as u50507056)
        id 5435C406005B5E47 for; Tue, 21 Oct 2014 15:36:13 +0200
Message-ID: <EF7FD7F6E8964FCAB62A6783BCE9EC51@acerDator>
From: =?iso-8859-1?Q?testsender=E4ger?= <>
To: <>
Subject: test
Date: Tue, 21 Oct 2014 15:36:09 +0200
MIME-Version: 1.0
Content-Type: multipart/alternative;
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Mailer: Microsoft Windows Live Mail 14.0.8117.416
X-MimeOLE: Produced By Microsoft MimeOLE V14.0.8117.416
X-Spam-Status: No, score=-0.7
X-Spam-Score: -6
X-Spam-Bar: /
X-Spam-Flag: NO

Det här är ett flerdelat meddelande i MIME-format.

Content-Type: text/plain;
Content-Transfer-Encoding: quoted-printable

You will not see this message, all you will see is ...

    Det h

Content-Type: text/html;
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<META content=3Dtext/html;charset=3Diso-8859-1 =
<META name=3DGENERATOR content=3D"MSHTML 11.00.9600.17344"></HEAD>
<BODY id=3DMailContainerBody=20
style=3D"PADDING-TOP: 15px; PADDING-LEFT: 10px; PADDING-RIGHT: 10px" =
topMargin=3D0 CanvasTabStop=3D"true" name=3D"Compose message area">
<DIV><FONT face=3DCalibri>Om namaha Shivaya</FONT></DIV>
<DIV><FONT face=3DCalibri></FONT>&nbsp;</DIV>
<DIV><FONT face=3DCalibri>Annelen G.</FONT></DIV></BODY></HTML>


The Swedish text directly after the headers may be causing Mailparse to drop the rest of the body ... all you get is "Det h".


Add a Patch

Pull Requests

Add a Pull Request

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Jul 12 21:01:30 2024 UTC