From 1cf20ba7a0b99b621d04e101dc59ee36b35a17c9 Mon Sep 17 00:00:00 2001 From: KEVDEMAS Date: Tue, 15 Nov 2022 11:11:28 +0100 Subject: [PATCH] fix Polyfill for imap_rfc822_write_address --- src/Polyfill.php | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/Polyfill.php b/src/Polyfill.php index 949e279..4fa4ad6 100644 --- a/src/Polyfill.php +++ b/src/Polyfill.php @@ -80,9 +80,18 @@ public static function rfc822ParseHeaders($headers, $defaultHost = 'UNKNOWN') ]; } - public static function rfc822WriteHeaders($string) + public static function rfc822WriteHeaders($mailbox, $hostname, $personal) { - return $string; + $ret = $mailbox; + if (!empty($hostname)) + { + $ret .= '@' . $hostname; + } + if (!empty($personal)) + { + $ret .= ' <' . $personal . '>'; + } + return $ret; } public static function utf7Decode($string)