code: public function toNode(DOMDocument $document = null)
      {
          if (null === $document) {
              $document = new DOMDocument();
          }
  
          $node = $document->createElement('EMailMessage');
  
          foreach ($this->getEmailAddresses() as $email) {
              $node->appendChild($document->createElement('EMailAddress', $email));
          }
  
          if ($this->getUndeliverableEmailAddress() !== null) {
              $node->appendChild($document->createElement('UndeliverableEMailAddress', $this->getUndeliverableEmailAddress()));
          }
  
          if ($this->getFromEmailAddress() !== null) {
              $node->appendChild($document->createElement('FromEMailAddress', $this->getFromEmailAddress()));
          }
  
          if ($this->getFromName() !== null) {
              $node->appendChild($document->createElement('FromName', $this->getFromName()));
          }
  
          if ($this->getMemo() !== null) {
              $node->appendChild($document->createElement('Memo', $this->getMemo()));
          }
  
          if ($this->getSubject() !== null) {
              $node->appendChild($document->createElement('Subject', $this->getSubject()));
          }
  
          if ($this->getSubjectCode() !== null) {
              $node->appendChild($document->createElement('SubjectCode', $this->getSubjectCode()));
          }
  
          return $node;
      }
docs: @param null|DOMDocument $document
  
  @return DOMElement