Skip to content

Base64 encoded text/plain mail incorrectly decoded in LegacyProtocol #386

Open
@DaWulli

Description

@DaWulli

Describe the bug

If using pop3 to retrieve base64 encoded text-emails, in this case from a Tobit David MailServer, the output is decoded wrong.

$content = $this->decodeString($part->content, $part->encoding);

is decoding the complete email, including headers, instead of only the content which results in unreadable characters.

Given the following raw-message:

From: "TEST Sender" sender@dev.local
Subject: ACMP-Fehler: Switch nicht erreichbar, Kunde: XXX DEV
To: "Alarmarchiv PGSS" alarm@dev.local,
"Ticketsystem" alarm@dev.local
X-Delivered-To: alarm@dev.local
Date: 09 Mar 2023 11:05:30 +0000
Priority: normal
X-Priority: 3 (Normal)
Importance: normal
X-David-Sym: 0
X-David-Flags: 0
Message-ID: 1111@mail.dev.local
MIME-Version: 1.0
Content-Type: text/plain;
charset="utf-8"
Content-Transfer-Encoding: base64

QUNNUC1GZWhsZXI6IFN3aXRjaCAKIlhYWCIgaXN0IG5pY2h0IGVycmVpY2hiYXIgYmVpIApYWFgg
UytDOgrDnGJlcndhY2h1bmdzYXJ0OiBQaW5nClVSTDogCklQLUFkcmVzc2U6IDAwMC4wMDAuMDAw
LjAwMHwKCk5ldHphZHJlc3NlOiAKQmVzY2hyZWlidW5nOiBQT0UtVW50ZXJ2ZXJ0ZWlsZXIgaW4g
SGFsbGUgZsO8ciBIYWxsZW50ZWxlZm9uCkhlcnN0ZWxsZXI6IFp5WGVsCkRhdHVtL1VocnplaXQ6
IDA5LjAzLjIwMjMgMTI6MDU6MjYKTGV0enRlciBLb250YWt0OiAyNS4wNy4yMDIyIDE1OjM4OjE0
ClRlYW12aWV3ZXItSUQ6IHh4eAp3ZWl0ZXJlIEluZm9ybWF0aW9uZW46IC0tLQo=

im getting following output

image

Used config

$this->client = $this->manager->make([
			'host' => '127.0.0.1',
				'port' => '110',
				'encryption' => false
				'validate_cert' => false,
				'username' => 'user',
				'password' => 'user',
				'protocol' => 'pop3',
			])

Code to Reproduce
The troubling code section which produces the reported bug.

		/** @var Folder $inbox */
		$inbox = $this->client->getFolderByName('INBOX');
		$messages = $inbox->messages()->unseen()->get();

Expected behavior
Get only the base64 encoded content decoded instead of the full raw-message including headers

Desktop / Server (please complete the following information):

  • OS: Debian 11
  • PHP: 8.1.8
  • Version: 4.1.2
  • Provider: Tobit David

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions