1
0
mirror of https://github.com/freescout-helpdesk/freescout.git synced 2025-01-31 20:11:38 +01:00

Webklex/php-imap: Decode partially encoded address names

This commit is contained in:
FreeScout 2025-01-19 23:18:22 -08:00
parent 38e22ef69c
commit c35b7ff3c0

View File

@ -710,18 +710,25 @@ class Header {
if (!property_exists($address, 'personal')) {
$address->personal = false;
} else {
$personalParts = $this->mime_header_decode($address->personal);
$personal_slices = explode(" ", $address->personal);
$address->personal = "";
foreach ($personal_slices as $slice) {
$personalParts = $this->mime_header_decode($slice);
if (is_array($personalParts)) {
$address->personal = '';
foreach ($personalParts as $p) {
$address->personal .= $this->convertEncoding($p->text, $this->getEncoding($p));
if (is_array($personalParts)) {
$personal = '';
foreach ($personalParts as $p) {
$personal .= $this->convertEncoding($p->text, $this->getEncoding($p));
}
}
}
if (strpos($address->personal, "'") === 0) {
$address->personal = str_replace("'", "", $address->personal);
if (str_starts_with($personal, "'")) {
$personal = str_replace("'", "", $personal);
}
$personal = \MailHelper::decodeSubject($personal);
$address->personal .= $personal . " ";
}
$address->personal = trim(rtrim($address->personal));
}
$address->mail = ($address->mailbox && $address->host) ? $address->mailbox . '@' . $address->host : false;