You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Don Ireland <sp...@donireland.com> on 2007/03/02 19:08:08 UTC

Message is Piped to a PHP script. CPANEL glitch preventing SA from Scanning before feeding to script.

Is there a way to have my PHP Script feed a message to SA to be 
scanned?  I can save the message as a text file if that'll help.

I'm using a hosted (shared hosting plan) web account with CPanel 
access.  I've noticed that email messages that have been routed through 
my email forwarders are not being scanned by SA--there is no X-SPAM header.

I've asked my host about it and got this reply "It sometimes does not as 
it is an bug with cpanel".  So I'm looking for a way to get the message 
scanned by SA.  And after the message has been scanned, is there someway 
to let a PHP script know that SA is done with the message?

Thanks.

Re: Message is Piped to a PHP script. CPANEL glitch preventing SA from Scanning before feeding to script.

Posted by Derek Harding <de...@innovyx.com>.
On Fri, 2007-03-02 at 12:40 -0800, Derek Harding wrote:
> On Fri, 2007-03-02 at 13:08 -0500, Don Ireland wrote:
> > Is there a way to have my PHP Script feed a message to SA to be 
> > scanned?  I can save the message as a text file if that'll help.
> 
> 
> 
> #!/usr/bin/php -q
> <?
> open(TMP, ">/tmp/sa.$$") || die("Error opening temp file: /tmp/sa.$$");
> print TMP $mess . "\r\n";
> close(TMP);
> 
> my $score = qx!/usr/bin/spamc -c </tmp/sa.$$!;
> chomp($score);
> if ($? >> 8 == 1)
>   echo "It's spam.\n";
> 
> unlink("/tmp/sa.$$");
> ?>

And guess who wrote perl instead of php? Yep, idiot here. Principle is
the same, codes a fraction different:

#!/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);
?>



Re: Message is Piped to a PHP script. CPANEL glitch preventing SA from Scanning before feeding to script.

Posted by Derek Harding <de...@innovyx.com>.
On Fri, 2007-03-02 at 13:08 -0500, Don Ireland wrote:
> Is there a way to have my PHP Script feed a message to SA to be 
> scanned?  I can save the message as a text file if that'll help.



#!/usr/bin/php -q
<?
open(TMP, ">/tmp/sa.$$") || die("Error opening temp file: /tmp/sa.$$");
print TMP $mess . "\r\n";
close(TMP);

my $score = qx!/usr/bin/spamc -c </tmp/sa.$$!;
chomp($score);
if ($? >> 8 == 1)
  echo "It's spam.\n";

unlink("/tmp/sa.$$");
?>

Derek