lib/ImapHelper.php
public function getPlainText(Part $part)
    {
        $text = null;

        if ($part->isMultipart()) {
            $partCount = $part->countParts();

            // Parse all parts
            for ($i = 0; $i < $partCount; $i++) {
                $subPart = $part->getPart($i + 1);

                // Check for headers, to avoid exceptions
                if ($subPart->getHeaders() !== null) {
                    if ($subPart->isMultipart()) {
                        // Part is multipart as well
                        $tmp = $this->getPlainText($subPart);
                        $text = ($tmp !== null) ? $tmp : $text;
                    } else {
                        // Try to get plain/text of this content
                        $tmp = $this->getPlainTextOfPart($subPart);
                        $text = ($tmp !== null) ? $tmp : $text;
                    }
                }
            }
        } else {
            // Its not multipart, so try to get its content
            $text = $this->getPlainTextOfPart($part);
        }

        return $text;
    }
public function getPlainText(Part $part)
    {
        $text = null;

        if ($part->isMultipart()) {
            $partCount = $part->countParts();

            // Parse all parts
            for ($i = 0; $i < $partCount; $i++) {
                $subPart = $part->getPart($i + 1);

                // Check for headers, to avoid exceptions
                if ($subPart->getHeaders() !== null) {
                    if ($subPart->isMultipart()) {
                        // Part is multipart as well
                        $tmp = $this->getPlainText($subPart);
                        $text = ($tmp !== null) ? $tmp : $text;
                    } else {
                        // Try to get plain/text of this content
                        $tmp = $this->getPlainTextOfPart($subPart);
                        $text = ($tmp !== null) ? $tmp : $text;
                    }
                }
            }
        } else {
            // Its not multipart, so try to get its content
            $text = $this->getPlainTextOfPart($part);
        }

        return $text;
    }
@param Part $part

@return string|null