/**
  * Search in the whole mail if there is a pattern that match
  *
  * @param string $pattern The pattern to search
  *
  * @return boolean
  */
 public function search($pattern)
 {
     // Search in the body and in the headers
     if (is_int(strpos($this->body, $pattern)) || $this->mailHeader->search($pattern)) {
         return true;
     }
     // Search in the attachment
     foreach ($this->attachments as $attach) {
         if ($attach->searchFilename($pattern) || $attach->searchContent($pattern)) {
             return true;
         }
     }
     return false;
 }
 public function testToArray()
 {
     $this->assertEquals($this->mailHeader->toArray(), array('msgno' => $this->mailHeader->getMsgNo(), 'to' => $this->mailHeader->getTo(), 'cc' => $this->mailHeader->getCc(), 'cco' => $this->mailHeader->getCco(), 'from' => $this->mailHeader->getFrom(), 'reply' => $this->mailHeader->getReply(), 'subject' => $this->mailHeader->getSubject(), 'unseen' => $this->mailHeader->getUnseen(), 'date' => $this->mailHeader->getDate(), 'size' => $this->mailHeader->getSize()));
 }