Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Zend\Mail\Storage\Mbox can't fetch messages due to header issues #193

Open
galvao opened this issue Feb 2, 2018 · 3 comments
Open

Zend\Mail\Storage\Mbox can't fetch messages due to header issues #193

galvao opened this issue Feb 2, 2018 · 3 comments

Comments

@galvao
Copy link

galvao commented Feb 2, 2018

PHP 7.2.2, Zend Mail at it's latest version as of today.

I'm opening an old mailbox file generated by Mozilla Thunderbird (please note that I get the same issue with other Thunderbird mailbox files). It has 2,521 messages and every single one of them causes this Zend\Mail\Exception\RuntimeException.

This issue happens:

  1. When trying to iterate through the mailbox file with a foreach (as shown in the docs);
  2. When trying to fetch a specific message after iterating via a count() + regular for loop .

And it's located at zendframework/zend-mail/src/Headers.php on line 109.

The exact headers causing the issue are X-Mozilla-Status and X-Account-Key. See the sample below (I've removed [potentially] sensitive data such as e-mail addresses, etc... for obvious reasons).

Line "X-Mozilla-Status: 0019
X-Mozilla-Status2: 00000000
X-Mozilla-Keys:                                                                                 
Received: (qmail 20021 invoked from network); 24 Apr 2008 14:23:38 -0300
Received: from [redacted].google.com (216.239.58.185) by [redacted]
        with SMTP; 24 Apr 2008 14:23:38 -0300
Received-SPF: softfail ([redacted]: transitioning SPF record at
        [redacted] does not designate [redacted] as permitted sender)
Received: by [redacted].google.com with SMTP id [redacted] for
        <[redacted]>; Thu, 24 Apr 2008 11:36:07 -0700 (PDT)
Received: by 10.150.49.1 with SMTP id [redacted]; Thu,
        24 Apr 2008 11:35:17 -0700 (PDT)
Received: by [redacted] with HTTP; Thu, 24 Apr 2008 11:35:17 -0700 (PDT)
Message-ID: <[redacted]@mail.gmail.com>
Date: Thu, 24 Apr 2008 15:35:17 -0300
From: "[redacted]" <[redacted]>
To: [redacted]
Subject: =?ISO-8859-1?[redacted]?=
In-Reply-To: <[redacted]>
MIME-Version: 1.0
Content-Type: multipart/related;  boundary="----=_Part_22_2026612.1209062117791"
References: <[redacted]>
X-Evolution-Source: [redacted]
X-Evolution: [redacted]
" does not match header format!

@galvao
Copy link
Author

galvao commented Feb 4, 2018

I believe a clarification is in order: I simply cannot fetch these messages. It doesn't matter if I catch this Exception or not, which is the reason for this issue.

@galvao
Copy link
Author

galvao commented Mar 2, 2018

Update: Using the second method (count + for loop) it's possible to catch the Exception, but still, every single message causes this Exception, making the task of reading these messages absolutely impossible.
Since Custom Headers seem to be a common thing, I'd remove this exception entirely or at least modify Zend\Mail so the presence of such a header doesn't block the entire operation of fetching a message.

@michalbundyra
Copy link
Member

This repository has been closed and moved to laminas/laminas-mail; a new issue has been opened at laminas/laminas-mail#37.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants