示例#1
0
 public function bodyString()
 {
     if (is_string($this->body)) {
         $body = $this->body;
         if ($this->{'Content-Transfer-Encoding'} == 'base64') {
             $body = wordwrap(base64_encode($body), 76, "\r\n", true);
         }
         return $body;
     }
     if (is_array($this->body)) {
         if (!$this->boundary) {
             $this->boundary = md5(microtime() . rand());
         }
         $str = "This is a message with multiple parts in MIME format.\r\n";
         foreach ($this->body as $part) {
             if (!$part instanceof SoxMIME) {
                 $part = new SoxMIME(null, $part);
             }
             $str .= "--{$this->boundary}\r\n";
             $str .= $part->__toString() . "\r\n";
         }
         $str .= "--{$this->boundary}--\r\n";
     }
     return $str;
 }