Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling boundary split into several parts in email headers #4567

Open
sofl88 opened this issue Feb 10, 2025 · 1 comment
Open

Handling boundary split into several parts in email headers #4567

sofl88 opened this issue Feb 10, 2025 · 1 comment
Labels
help wanted Extra attention is needed

Comments

@sofl88
Copy link

sofl88 commented Feb 10, 2025

Hello

First of all, I'd be fine if this can't be fixed. I tried opening/viewing the email in other clients like mozilla thunderbird and they had trouble showing the containing html part and attachments (it looked like an empty email with no attachments).

There was a conversation with a customer who uses protonmail (I assume it was protonmail because there was a protonmail_quote class in the reply). The initial thread (started by the customer) had no boundary keyword in the source code.

We replied to this email and the next reply by the customer, threw this on fetching

throw new GetMessagesFailedException($e->getMessage(), 0, $e);

which is based on (I guess)

throw new MessageContentFetchingException("no content found", 0);

I'm not allowed to send you the full eml because of privacy reasons but debugging it myself, it turned out that there was a boundary definition but it was below the header part.

...
MIME-Version: 1.0
Content-Type: multipart/signed; protocol="application/pgp-signature";
 micalg="pgp-sha256";
 boundary*0*=us-ascii''------3f0eb27c226a6efc44713e1b8f40befd34d8d3c9199e2ad0;
 boundary*1*=4dab9839cbbd3524; charset="utf-8"
Subject: xxx
From: xxx.mozmail.com
To: xxx
Reply-To: xxx.mozmail.com
Message-ID: <01010193e3541c82-eb777366-8e63-40b1-b965-b5744281949e-000000@us-west-2.amazonses.com>
Date: Fri, 20 Dec 2024 09:09:20 +0000
Feedback-ID: ::1.us-west-2.ITvMGFKQSliLUDgUkj88cpkYooqNc9k/L6kQx85KKBU=:AmazonSES
X-SES-Outgoing: 2024.12.20-76.223.145.248
X-Dmarc-Test: Allow
X-Spamd-Bar: -----
X-KasLoop: yyy

This is an OpenPGP/MIME signed message (RFC 4880 and 3156)
--------3f0eb27c226a6efc44713e1b8f40befd34d8d3c9199e2ad04dab9839cbbd3524
Content-Type: multipart/mixed; boundary=-------------------d39fee57ea0e0a2198fb268551febf6e

---------------------d39fee57ea0e0a2198fb268551febf6e
Content-Transfer-Encoding: quoted-printable
Content-Type: text/html; charset=utf-8
...

When it comes to match the boundary defintion, $this->raw ends with X-KasLoop: yyy

if (preg_match_all($pattern, $this->raw, $matches)) {

So I think since the boundary is not properly extracted, the error occurs.

PHP version: 8.3
FreeScout version: 1.8.70
Database: MySQL
Are you using CloudFlare: No
Are you using non-official modules: Yes

Thanks in advance

@freescout-help
Copy link
Collaborator

It looks like the boundary in headers was too long and it was split into two parts:

 boundary*0*=us-ascii''------3f0eb27c226a6efc44713e1b8f40befd34d8d3c9199e2ad0;
 boundary*1*=4dab9839cbbd3524; charset="utf-8"

For now Webklex/php-imap library can't handle such cases.

@freescout-help freescout-help changed the title Boundary not part of protonmail reply header causes no content found in Query.php:323 Handling boundary split into several parts in email headers Feb 10, 2025
@freescout-help freescout-help added the help wanted Extra attention is needed label Feb 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants