public function parseMailDefinition($xml, $locale = null)
    {
        $this->validator->validate($xml, $this->xsdFile);

        $parsed = simplexml_load_string($xml);

        $message = new ParsedMessage();

        $from = $parsed->from;
        if ($from->count() > 0) {
            $message->setFrom((string)$from, (string)$from->attributes()['name']);
        }

        $replyTo = $parsed->replyTo;
        if ($replyTo->count() > 0) {
            $message->setReplyTo((string)$replyTo);
        }

        foreach ($parsed->to as $to) {
            $message->addTo((string)$to, (string)$to->attributes()['name']);
        }
        foreach ($parsed->cc as $cc) {
            $message->addCc((string)$cc, (string)$cc->attributes()['name']);
        }
        foreach ($parsed->bcc as $bcc) {
            $message->addBcc((string)$bcc, (string)$bcc->attributes()['name']);
        }

        $message->setSubject($this->getLocalizedTagContent($parsed->subject, $locale));

        $message->setMessageHtml($this->getLocalizedTagContent($parsed->messageHtml, $locale));
        $message->setMessageText($this->getLocalizedTagContent($parsed->messageText, $locale));

        return $message;
    }
public function parseMailDefinition($xml, $locale = null)
    {
        $this->validator->validate($xml, $this->xsdFile);

        $parsed = simplexml_load_string($xml);

        $message = new ParsedMessage();

        $from = $parsed->from;
        if ($from->count() > 0) {
            $message->setFrom((string)$from, (string)$from->attributes()['name']);
        }

        $replyTo = $parsed->replyTo;
        if ($replyTo->count() > 0) {
            $message->setReplyTo((string)$replyTo);
        }

        foreach ($parsed->to as $to) {
            $message->addTo((string)$to, (string)$to->attributes()['name']);
        }
        foreach ($parsed->cc as $cc) {
            $message->addCc((string)$cc, (string)$cc->attributes()['name']);
        }
        foreach ($parsed->bcc as $bcc) {
            $message->addBcc((string)$bcc, (string)$bcc->attributes()['name']);
        }

        $message->setSubject($this->getLocalizedTagContent($parsed->subject, $locale));

        $message->setMessageHtml($this->getLocalizedTagContent($parsed->messageHtml, $locale));
        $message->setMessageText($this->getLocalizedTagContent($parsed->messageText, $locale));

        return $message;
    }
public function parseMailDefinition ( $ xml , $ locale = null ) { $ this -> validator -> validate ( $ xml , $ this -> xsdFile ) ; $ parsed = simplexml_load_string ( $ xml ) ; $ message = new ParsedMessage ( ) ; $ from = $ parsed -> from ; if ( $ from -> count ( ) > 0 ) { $ message -> setFrom ( ( string ) $ from , ( string ) $ from -> attributes ( ) [ 'name' ] ) ; } $ replyTo = $ parsed -> replyTo ; if ( $ replyTo -> count ( ) > 0 ) { $ message -> setReplyTo ( ( string ) $ replyTo ) ; } foreach ( $ parsed -> to as $ to ) { $ message -> addTo ( ( string ) $ to , ( string ) $ to -> attributes ( ) [ 'name' ] ) ; } foreach ( $ parsed -> cc as $ cc ) { $ message -> addCc ( ( string ) $ cc , ( string ) $ cc -> attributes ( ) [ 'name' ] ) ; } foreach ( $ parsed -> bcc as $ bcc ) { $ message -> addBcc ( ( string ) $ bcc , ( string ) $ bcc -> attributes ( ) [ 'name' ] ) ; } $ message -> setSubject ( $ this -> getLocalizedTagContent ( $ parsed -> subject , $ locale ) ) ; $ message -> setMessageHtml ( $ this -> getLocalizedTagContent ( $ parsed -> messageHtml , $ locale ) ) ; $ message -> setMessageText ( $ this -> getLocalizedTagContent ( $ parsed -> messageText , $ locale ) ) ; return $ message ; }
Parse XML Mail Definition string

which looks something like this
<code>
<email>
<to name="yourname">your@mail.com</email>
<subject locale="de">Your subject</subject>
<messageText locale="de">Your Message</messageText>
</email>
</code>

@param string $xml
@param string $locale

@return ParsedMessage

@throws \Exception
Parse XML Mail Definition string