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

Closed
wkania opened this issue Aug 28, 2024 · 2 comments
Closed

Address personal field is not decoded #511

wkania opened this issue Aug 28, 2024 · 2 comments
Labels
bug Something isn't working confirmed solved

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());

@Webklex Webklex added bug Something isn't working validating confirmed and removed validating labels Jan 17, 2025
@Webklex Webklex added the solved label Jan 19, 2025
@Webklex Webklex closed this as completed Jan 19, 2025
@mob6085
Copy link

mob6085 commented Jan 19, 2025

The problem persists when the imap extension is not loaded. Version: php-imap 6.1.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working confirmed solved
Projects
None yet
Development

No branches or pull requests

3 participants