public function compose($body = null, $mimeType = null)
    {
        // Supported types are null, ViewModel and string.
        if (null !== $body && !is_string($body) && !($body instanceof ViewModel)) {
            throw new InvalidArgumentException(
                'Invalid value supplied. Expected null, string or instance of Zend\View\Model\ViewModel.'
            );
        }

        $body    = $this->manipulateBody($body, $mimeType);
        $message = new Message;

        $message->setBody($body);

        if ($this->config['message']['generate_alternative_body'] && count($body->getParts()) > 1) {
            $message->getHeaders()->get('content-type')->setType('multipart/alternative');
        }

        $this->applyMessageHeaders($message);
        $this->applyMessageOptions($message);

        return $message;
    }
public function compose($body = null, $mimeType = null)
    {
        // Supported types are null, ViewModel and string.
        if (null !== $body && !is_string($body) && !($body instanceof ViewModel)) {
            throw new InvalidArgumentException(
                'Invalid value supplied. Expected null, string or instance of Zend\View\Model\ViewModel.'
            );
        }

        $body    = $this->manipulateBody($body, $mimeType);
        $message = new Message;

        $message->setBody($body);

        if ($this->config['message']['generate_alternative_body'] && count($body->getParts()) > 1) {
            $message->getHeaders()->get('content-type')->setType('multipart/alternative');
        }

        $this->applyMessageHeaders($message);
        $this->applyMessageOptions($message);

        return $message;
    }
public function compose ( $ body = null , $ mimeType = null ) { // Supported types are null, ViewModel and string. if ( null !== $ body && ! is_string ( $ body ) && ! ( $ body instanceof ViewModel ) ) { throw new InvalidArgumentException ( 'Invalid value supplied. Expected null, string or instance of Zend\View\Model\ViewModel.' ) ; } $ body = $ this -> manipulateBody ( $ body , $ mimeType ) ; $ message = new Message ; $ message -> setBody ( $ body ) ; if ( $ this -> config [ 'message' ] [ 'generate_alternative_body' ] && count ( $ body -> getParts ( ) ) > 1 ) { $ message -> getHeaders ( ) -> get ( 'content-type' ) -> setType ( 'multipart/alternative' ) ; } $ this -> applyMessageHeaders ( $ message ) ; $ this -> applyMessageOptions ( $ message ) ; return $ message ; }
Compose a new message.

@param   mixed   $body   Accepts instance of ViewModel, string and null.
@param   string  $mimeType

@return  \Zend\Mail\Message
@throws  \SxMail\Exception\InvalidArgumentException
Compose a new message .