private function workAroundMissingBoundary(Part $part, $rawMailBody)
    {
        try {
            $part->countParts();
        } catch (RuntimeException $e) {
            if (count($part->getHeaders()) > 0
                && $part->getHeaders()->has('Content-Type')
                && array_key_exists('boundary', $this->getContentType($part)->getParameters())
            ) {
                $boundary = $part
                    ->getHeaders()
                    ->get('Content-Type')
                    ->getParameter('boundary');

                $content = trim($rawMailBody);
                $content .= "\n--{$boundary}--";

                $part = $this->partFactory->getPart($content);
            }
        }

        return $part;
    }