private function fetchStructure($structure, $partNumber = null) {
        $this->client->openFolder($this->folder_path);

        if ($structure->type == IMAP::MESSAGE_TYPE_TEXT &&
            ($structure->ifdisposition == 0 ||
                ($structure->ifdisposition == 1 && !isset($structure->parts) && $partNumber == null)
            )
        ) {
            if ($structure->subtype == "PLAIN") {
                if (!$partNumber) {
                    $partNumber = 1;
                }

                $encoding = $this->getEncoding($structure);

                $content = imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber, $this->fetch_options | IMAP::FT_UID);
                $content = $this->decodeString($content, $structure->encoding);

                // We don't need to do convertEncoding() if charset is ASCII (us-ascii):
                //     ASCII is a subset of UTF-8, so all ASCII files are already UTF-8 encoded
                //     https://stackoverflow.com/a/11303410
                //
                // us-ascii is the same as ASCII:
                //     ASCII is the traditional name for the encoding system; the Internet Assigned Numbers Authority (IANA)
                //     prefers the updated name US-ASCII, which clarifies that this system was developed in the US and
                //     based on the typographical symbols predominantly in use there.
                //     https://en.wikipedia.org/wiki/ASCII
                //
                // convertEncoding() function basically means convertToUtf8(), so when we convert ASCII string into UTF-8 it gets broken.
                if ($encoding != 'us-ascii') {
                    $content = $this->convertEncoding($content, $encoding);
                }

                $body = new \stdClass;
                $body->type = "text";
                $body->content = $content;

                $this->bodies['text'] = $body;

                $this->fetchAttachment($structure, $partNumber);

            } elseif ($structure->subtype == "HTML") {
                if (!$partNumber) {
                    $partNumber = 1;
                }

                $encoding = $this->getEncoding($structure);

                $content = imap_fetchbody($this->client->getConnection(), $this->uid, $partNumber, $this->fetch_options | IMAP::FT_UID);
                $content = $this->decodeString($content, $structure->encoding);
                if ($encoding != 'us-ascii') {
                    $content = $this->convertEncoding($content, $encoding);
                }

                $body = new \stdClass;
                $body->type = "html";
                $body->content = $content;

                $this->bodies['html'] = $body;
            }
        } elseif ($structure->type == IMAP::MESSAGE_TYPE_MULTIPART) {
            foreach ($structure->parts as $index => $subStruct) {
                $prefix = "";
                if ($partNumber) {
                    $prefix = $partNumber.".";
                }
                $this->fetchStructure($subStruct, $prefix.($index + 1));
            }
        } else {
            if ($this->getFetchAttachmentOption() === true) {
                $this->fetchAttachment($structure, $partNumber);
            }
        }
    }