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

POP3 getMessage fails with 'Line "<==UUID==>" does not match header format' #245

@abulhol

Description

@abulhol

We are using zend-mail to fetch emails via POP3 and IMAP.
For integration tests, we run an instance of Flying Rat (https://pypi.org/project/flyingrat/) to mock a mail server with POP3. We build multipart emails in Python using MIMEMultipart and send them to the server via smtplib (all standard code used there, nothing fancy).

Now when I try to fetch the emails in zend-mail via getMessage(), it fails with the following exception::

Line "--===============0544532757501787723==" does not match header format!
vendor/zendframework/zend-mail/src/Storage/Part.php(112):   Zend\Mail\Headers::fromString('MIME-Version: 1...')
vendor/zendframework/zend-mail/src/Storage/Message.php(56): Zend\Mail\Storage\Part->__construct(Array)
vendor/zendframework/zend-mail/src/Storage/Pop3.php(63): Zend\Mail\Storage\Message->__construct(Array)
ourclass.php(298): Zend\Mail\Storage\Pop3->getMessage(1)

I have tried to debug this and printed out the $params in Message.php _construct.
It looks to me like zend-mail is not able to parse the headers correctly because Flying Rat does not support the TOP command and so the whole message is downloaded. Could this be a bug?

Here is the full debug output of the $params::

 (
     [handler] => Zend\Mail\Storage\Pop3 Object
         (
             [protocol:protected] => Zend\Mail\Protocol\Pop3 Object
                 (
                     [hasTop] =>
                     [socket:protected] => Resource id #9
                     [timestamp:protected] =>
                 )

             [has:protected] => Array
                 (
                     [uniqueid] =>
                     [delete] =>
                     [create] =>
                     [top] =>
                     [fetchPart] =>
                     [flags] =>
                 )

             [iterationPos:protected] => 0
             [iterationMax:protected] =>
             [messageClass:protected] => Zend\Mail\Storage\Message
         )

     [id] => 2
     [headers] => Content-Type: multipart/alternative;
  boundary="===============0544532757501787723=="
 MIME-Version: 1.0
 To: [email protected]
 From: [email protected]
 Subject: Test Url in Text
 Message-Id: <[email protected]>

 --===============0544532757501787723==
 Content-Type: text/plain; charset="us-ascii"
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit

 No URL here
 --===============0544532757501787723==
 Content-Type: text/html; charset="us-ascii"
 MIME-Version: 1.0
 Content-Transfer-Encoding: 7bit

 https://example.net
 --===============0544532757501787723==--

     [noToplines] => 1
 )

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions