trying maildrop
[old-projects.git] / philter / philter / include / plugin_autoreply.inc.php
index 25a9788..95de752 100644 (file)
@@ -32,14 +32,15 @@ EOF;
     function to_string($_data) {
         $uid = get_user_id();
         $text = explode("\n",$_data[1]);
-        $res = "    :0 hc\n"
-            .  "    * !^FROM_DAEMON\n"
-            .  "    * !^X-Philter-Autoreply: $uid\n"
-            .  "    | ( formail -rI'Precedence: junk' -A'X-Philter-Autoreply: $uid; \ \n";
+
+        $res = "    if(! /^X-Philter-Autoreply: $uid$/)\n" # TODO : et ne vient pas da démon
+            .  "    {\n"
+            .  "        to \"| reformail -rt -A'X-Philter-Autoreply: $uid' \\\n"
+            .  "            | ( cat - ; echo '' ; \\\n";
         foreach($text as $line)
-            $res .= "        echo ".escapeshellarg(chop($line))."; \ \n";
-        $res.= "      ) | $"."SENDMAIL -oi -t\n";
-        return $res;
+            $res .= "                echo ".escapeshellarg(chop($line))."; \\\n";
+        $res.= "            ) | $"."SENDMAIL -oi -t\"\n";
+        return $res."    }\n";
     }
 }