private function parseHeader(string $key, $value)
    {
        switch ($key) {
            case 'msgno':
                return (int) $value;
            case 'from':
            case 'to':
            case 'cc':
            case 'bcc':
            case 'reply_to':
            case 'sender':
            case 'return_path':
                /** @var \stdClass $address */
                foreach ($value as $address) {
                    if (isset($address->mailbox)) {
                        $address->host     = $address->host ?? null;
                        $address->personal = isset($address->personal) ? $this->decode($address->personal) : null;
                    }
                }

                return $value;
            case 'date':
            case 'subject':
                return $this->decode($value);
        }

        return $value;
    }