On 4/17/07, Derek Harding <[EMAIL PROTECTED]> wrote:

On Tue, 2007-04-17 at 16:52 +0530, BG Mahesh wrote:
>
> hi
>
> I want to pass the comments/text entered by users on a form to
> SpamAssassin for approval. If it approves it only then I want to
> accept the text, else I want to inform the user that the text is Spam
> and reject the user's comments.
>
> We use PHP and want to know how to implement this.

Someone asked about SA from PHP on this list back in March. Here is what
I wrote then:

#!/usr/bin/php -q
<?
$fname = tempnam("/tmp", "sa");
file_put_contents($fname, $message);

exec("/usr/bin/spamc -c <$fname", $score, $res);

if ($res == 1)
  echo "It's spam.\n";

unlink($fname);
?>

TBH I'm not sure SA is really going to help you here since you'll have
zero headers for it to work on meaning you're pretty much down to
content & URIBL checks.

Derek



We have tested this on http://cause.greynium.com/spamtest.php
We have constructed a Mail header, concatenating $message to $header and
passing the contents of $header to the code given above.


We have installed the script from rulesemporium to update the cf files.

What could we be missing?

--
--
B.G. Mahesh
http://www.greynium.com/
http://www.oneindia.in/
http://www.click.in/ - Free Indian Classifieds

Reply via email to