Re: Trouble with training

Matthias Andree <[email protected]>
Newsgroups gmane.mail.bogofilter.general
Message-ID <[email protected]>
On Wed, 19 Mar 2008, 'Stefan Geißler' wrote:

> Hi,
> 
> I have a problem with training the bogofilter. I use a PHP script. This 
> script adds head and body of an email into a file and passes it as 
> parameter for training to the filter.
> I use following functions:
> 
> 1.) Retrieve the email header:
> function getplainheader()
> {
>   return 
> imap_fetchheader($this->rm_mailbox,$this->rm_currentmessage,FT_UID|FT_INTERNAL|FT_PREFETCHTEXT 
> );
> }
> 
> 2.) Retrieve the mail body:
> function dump_body2()
> {
>    return 
> imap_body($this->rm_mailbox,$this->rm_currentmessage,FT_UID|FT_INTERNAL);
> }
> 
> Then I do following:
> function evaluate_bogospam($rcmail )
> {
>      $mailtext = $rcmail->getplainheader();
>      $mailtext .= $rcmail->dump_body2();
> 
>      if( trim( $mailtext ) != "" )
>      {
>          $filename = 
> "/home/wwwdev/public_html/develope/receivemail/mailbody";
>          $fp = @fopen( $filename, "w" );
>          @fputs( $fp, $mailtext );
>          @fclose( $fp );
> 
>          $cmd = "bogofilter -T -d /home/wwwdev/public_html/local -I 
> ".$filename;
> 
>          exec( $cmd, $ausgabe2, $returnvar );
> 
>          echo "Bogo Filter return value : ".$returnvar . "   :   " . 
> $ausgabe2[0]."<br>";
>      }
> }
> 
> The problem is, that I get in bogosity an "unknown" while the test 
> function above gives me a clear "spam". The related mail was trained 
> before in the same way as shown above.

Missing the "test function above" and not knowing PHP much (lack of
interest and too many security loopholes in deployment), but taking .=
for a string concatenation operator:

Does $mailtext contain the separating blank line between header and
body? That's crucial, since bogofilter treats headers and body
separately.

-- 
Matthias Andree
_______________________________________________
Bogofilter mailing list
[email protected]
http://www.bogofilter.org/mailman/listinfo/bogofilter
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.