Swift_Mime_SimpleMessage::toString PHP Method

toString() public method

Get this message as a complete string.
public toString ( ) : string
return string
    public function toString()
    {
        if (count($children = $this->getChildren()) > 0 && $this->getBody() != '') {
            $this->setChildren(array_merge(array($this->becomeMimePart()), $children));
            $string = parent::toString();
            $this->setChildren($children);
        } else {
            $string = parent::toString();
        }
        return $string;
    }

Usage Example

 /**
  * Get this message as a complete string.
  *
  * @return string
  */
 public function toString()
 {
     if (empty($this->headerSigners) && empty($this->bodySigners)) {
         return parent::toString();
     }
     $this->saveMessage();
     $this->doSign();
     $string = parent::toString();
     $this->restoreMessage();
     return $string;
 }