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

Address personal field is not decoded #511

Open
wkania opened this issue Aug 28, 2024 · 1 comment
Open

Address personal field is not decoded #511

wkania opened this issue Aug 28, 2024 · 1 comment

Comments

@wkania
Copy link

wkania commented Aug 28, 2024

Personal field in Address class should also be decoded. From, To, CC, and Bcc are affected by this bug.

use Webklex\PHPIMAP\Address;

 /** @var Address $from */
$from = $mail->getFrom()->first();
// COMPANYNAME | =?iso-8859-2?q?us=B3ugi?
echo $from->personal;
// COMPANYNAME | usługi
echo mb_decode_mimeheader($from->personal);

/** @var Address $address */
foreach ($mail->getTo()->all() as $address) {
    echo $address->personal;
}

Expected behavior
It seems the Header->decode method should also be applied to the personal field inside Header->decodeAddresses, in the same way it is applied to the subject inside Header->parse.

Desktop / Server:

  • OS: Alpine:3.20.2
  • PHP: 8.3
  • Version: php-imap 5.5.0
  • Provider: Unknown, old, on premise in the private company
@wkania
Copy link
Author

wkania commented Sep 4, 2024

The problem also exists when the subject is encoded as UTF-8, like that:

// =?utf-8?B?UkU6IFtFWFRFUk5BTF0gUmU6IExvcmVtIElwc3VtIC8=?= =?utf-8?Q?40_one?=
echo $mail->getSubject();
// RE: [EXTERNAL] Re: Lorem Ipsum / 40 one
echo mb_decode_mimeheader($mail->getSubject());

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

No branches or pull requests

1 participant