[imp] spamassassin/razor tie-in ...

Marc G. Fournier scrappy@hub.org
Thu, 25 Apr 2002 15:56:50 -0300 (ADT)


On Thu, 25 Apr 2002, Chuck Hagenbuch wrote:

> Quoting "Marc G. Fournier" <scrappy@hub.org>:
>
> > What would it take to make this allow the admin to setup a program,
> > instead of email address?  I'd like to set it up so that its enabled,
> > but that it just pipes the message through "/usr/local/bin/spamassassin -
> > r" so that it gets submit'd to razor ...
>
> Probably not too much work. I can add it to my todo list...

Would it be as simple as:

*** message.php.orig    Thu Apr 25 15:49:29 2002
--- message.php Thu Apr 25 15:55:14 2002
***************
*** 344,349 ****
--- 344,356 ----
           break;
       }

+      if($conf['spam']['program']) {
+        $raw_msg = imap_fetchheader($imp['stream'], $index, FT_UID) . "\n" . imap_body($imp['stream'], $index, FT_UID);
+        exec("echo $raw_msg | " . $conf['spam']['program'] . ' -a ' . $spell_opt, $warnings);
+        $notification->push(_("This message has been reported as spam."), 'horde.message');
+        break;
+      }
+
       /* Fetch the raw message contents (headers and first 10k of body). */
       $raw_msg = imap_fetchheader($imp['stream'], $index, FT_UID) . "\n" .
           substr(imap_body($imp['stream'], $index, FT_UID), 0, 10240);
*** config/conf.php.dist.orig   Thu Apr 25 15:46:03 2002
--- config/conf.php.dist        Thu Apr 25 15:47:14 2002
***************
*** 199,204 ****
--- 199,205 ----

  // If so, where should those messages be reported to?
  $conf['spam']['email'] = 'postmaster@' . $GLOBALS['registry']->getParam('server_name');
+ // $conf['spam']['program'] = '/usr/local/bin/spamassassin -r';


  /**