Added a search by header option to filters -- needs error checking on the searchstring
[squirrelmail.git] / plugins / filters / filters.php
index 887d2c87d1995b98dc2bdff2d9d9863c5c1a786c..a144822c08721bd1f839c4df5b339eb0521cab36 100644 (file)
@@ -333,6 +333,11 @@ function filter_search_and_delete($imap, $where, $what, $where_to) {
     } else {
         $search_str = "SEARCH CHARSET US-ASCII ALL ";
     }
+    if ($where == "Header") {
+       $what = explode(':', $what);
+       $where = trim($where . ' ' . $what[0]);
+       $what = addslashes(trim($what[1]));
+    }
     $search_str .= $where . ' {' . strlen($what) . "}\r\n" . $what . "\r\n";
     
     fputs ($imap, "a001 $search_str");