/**
  * 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 testSearchFilename()
 {
     $this->assertTrue($this->mailHeader->search('Jose Luis Cardosa'));
     $this->assertTrue($this->mailHeader->search('Not found ') == false);
 }