Jyxo\Mail\Sender::createBody PHP Method

createBody() private method

Creates body.
private createBody ( )
    private function createBody()
    {
        switch ($this->type) {
            case self::TYPE_ATTACHMENTS:
                $contentType = $this->email->body->isHtml() ? 'text/html' : 'text/plain';
                $this->createdBody .= $this->getBoundaryStart($this->boundary[1], $contentType, $this->charset, $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->encodeString($this->changeCharset($this->email->body->main), $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->attachAll();
                break;
            case self::TYPE_ALTERNATIVE_ATTACHMENTS:
                $this->createdBody .= '--' . $this->boundary[1] . self::LINE_END;
                $this->createdBody .= 'Content-Type: multipart/alternative;' . self::LINE_END . ' boundary="' . $this->boundary[2] . '"' . self::LINE_END . self::LINE_END;
                $this->createdBody .= $this->getBoundaryStart($this->boundary[2], 'text/plain', $this->charset, $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->encodeString($this->changeCharset($this->email->body->alternative), $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->getBoundaryStart($this->boundary[2], 'text/html', $this->charset, $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->encodeString($this->changeCharset($this->email->body->main), $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->getBoundaryEnd($this->boundary[2]) . self::LINE_END;
                $this->createdBody .= $this->attachAll();
                break;
            case self::TYPE_ALTERNATIVE:
                $this->createdBody .= $this->getBoundaryStart($this->boundary[1], 'text/plain', $this->charset, $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->encodeString($this->changeCharset($this->email->body->alternative), $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->getBoundaryStart($this->boundary[1], 'text/html', $this->charset, $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->encodeString($this->changeCharset($this->email->body->main), $this->encoding) . self::LINE_END;
                $this->createdBody .= $this->getBoundaryEnd($this->boundary[1]);
                break;
            case self::TYPE_SIMPLE:
                // Break missing intentionally
            // Break missing intentionally
            default:
                $this->createdBody = $this->encodeString($this->changeCharset($this->email->body->main), $this->encoding);
                break;
        }
    }