src/Service/MailService.php
private function buildBody($body, string $charset): Mime\Message
    {
        if ($body instanceof Mime\Message) {
            return $body;
        }

        // If the body is a string, wrap it into a Mime\Part
        if (is_string($body)) {
            $mimePart = new Mime\Part($body);
            $mimePart->type = $body !== strip_tags($body) ? Mime\Mime::TYPE_HTML : Mime\Mime::TYPE_TEXT;
            $body = $mimePart;
        }

        $body->charset = $charset;
        $message = new Mime\Message();
        $message->setParts([$body]);
        return $message;
    }
private function buildBody($body, string $charset): Mime\Message
    {
        if ($body instanceof Mime\Message) {
            return $body;
        }

        // If the body is a string, wrap it into a Mime\Part
        if (is_string($body)) {
            $mimePart = new Mime\Part($body);
            $mimePart->type = $body !== strip_tags($body) ? Mime\Mime::TYPE_HTML : Mime\Mime::TYPE_TEXT;
            $body = $mimePart;
        }

        $body->charset = $charset;
        $message = new Mime\Message();
        $message->setParts([$body]);
        return $message;
    }
private function buildBody ( $ body , string $ charset ) : Mime \ Message { if ( $ body instanceof Mime \ Message ) { return $ body ; } // If the body is a string, wrap it into a Mime\Part if ( is_string ( $ body ) ) { $ mimePart = new Mime \ Part ( $ body ) ; $ mimePart -> type = $ body !== strip_tags ( $ body ) ? Mime \ Mime :: TYPE_HTML : Mime \ Mime :: TYPE_TEXT ; $ body = $ mimePart ; } $ body -> charset = $ charset ; $ message = new Mime \ Message ( ) ; $ message -> setParts ( [ $ body ] ) ; return $ message ; }
Sets the message body
@param string|Mime\Part|Mime\Message $body
@param string $charset
@return Mime\Message
@throws Mime\Exception\InvalidArgumentException
Sets the message body