Skip to content

Commit e5d5f0b

Browse files
authored
fix: add missing transform of email from returnPath (#107)
1 parent 0eb7d89 commit e5d5f0b

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/Controller/Api/MailArchiveController.php

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,15 +248,19 @@ private function enrichFromDatabase(MailArchiveEntity $mailArchive, Email $email
248248
}
249249

250250
/**
251-
* @return string|array<Address>|\DateTimeImmutable|null
251+
* @return string|array<string|Address>|\DateTimeImmutable|null
252252
*/
253253
private function getHeaderValue(IHeader $header): string|array|null|\DateTimeImmutable
254254
{
255255
if ($header instanceof AddressHeader) {
256256
/** @var AddressPart[] $addressParts */
257257
$addressParts = $header->getParts();
258258

259-
return \array_map(function (AddressPart $part) {
259+
return \array_map(function (AddressPart $part) use ($header) {
260+
if ($header->getName() === 'Return-Path') {
261+
return $part->getEmail();
262+
}
263+
260264
return new Address($part->getEmail(), $part->getName());
261265
}, $addressParts);
262266
}
@@ -290,7 +294,7 @@ private function getContent(?string $emlPath): false|string
290294
}
291295

292296
/**
293-
* @param \DateTimeImmutable|array<Address>|string|null $headerValue
297+
* @param \DateTimeImmutable|array<string|Address>|string|null $headerValue
294298
*/
295299
private function determineReturnPath(\DateTimeImmutable|array|string|null $headerValue): ?string
296300
{

0 commit comments

Comments
 (0)