You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@spamassassin.apache.org by Pollywog <li...@shadypond.com> on 2005/12/04 21:16:50 UTC

using LearnAsSpam IMAP folder

I am running Spamassassin 3.0.2 and Fetchmail 6.2.5 on Xandros, which is 
similar to Debian "Sarge".

I followed the directions in the Spamassassin wiki at 
http://wiki.apache.org/spamassassin/SingleUserUnixInstall
under the section "Enable IMAP LearnAsSpam folder".

The problem is that no matter how I specify the IMAP folder, as 
"LearnAsSpam" (without quotes), "Maildir/.LearnAsSpam" etc, fetchmail is 
unable to find the IMAP folder.  I am using kmail to create the folder and no 
matter where I put the folder, fetchmail cannot find it.

Has anyone done this successfully with kmail?  I also have Thunderbird and I 
could use that.

thanks

8)

Re: using LearnAsSpam IMAP folder [SOLVED]

Posted by Pollywog <li...@shadypond.com>.
On 12/04/2005 11:18 pm, Tyler Nally wrote:
> On Sunday 04 December 2005 05:59 pm, Pollywog wrote:
> > I do that as well and have no problem, but when I use the fetchmail as
> > shown at the URL I posted (the command goes into a crontab), fetchmail
> > can't find the IMAP folder.
>
> I wonder if it's just the way you refer to the sub-folders with
> fetchmail in order to fetch the right directories.... "Fetchmail"
> being essentially a "dumb" utility .. you might have to provide it
> with more information before it can find what YOU are looking for.
>
> A quick scan of Google looking for "fetchmail IMAP" had someone
> calling fetchmail like this using the IMAP protocol and fetchmail
> reading certain folders:
>
> fetchmail -k -a -p IMAP \
>     -S localhost \
>     --smtpname some.mailbox@gmail.com \
>     -u username \
>     --auth password \
>     -r "Inbox.folder1","Inbox.folder2","Inbox.etc" \
>     -v mailserver.domain.com
>
> ... with the "Inbox" representing the home "Maildir" path
> and the "Inbox.folder1" representing the first named sub-folder
> within the main maildir... and "Inbox.folder2" the 2nd, etc.

Thanks for the info, this worked  :)

This is what I did, following what you posted:
$ fetchmail -a -v -n -r "Inbox.LearnAsSpam" -m 'sa-learn -D --spam'   


Thanks for your help, now to see if this will work from a crontab, which 
should not be a problem.

8)

Re: using LearnAsSpam IMAP folder

Posted by Tyler Nally <tn...@technally.com>.
On Sunday 04 December 2005 05:59 pm, Pollywog wrote:

> I do that as well and have no problem, but when I use the fetchmail as
> shown at the URL I posted (the command goes into a crontab), fetchmail
> can't find the IMAP folder. 

I wonder if it's just the way you refer to the sub-folders with
fetchmail in order to fetch the right directories.... "Fetchmail" 
being essentially a "dumb" utility .. you might have to provide it
with more information before it can find what YOU are looking for.

A quick scan of Google looking for "fetchmail IMAP" had someone 
calling fetchmail like this using the IMAP protocol and fetchmail
reading certain folders:

fetchmail -k -a -p IMAP \
    -S localhost \
    --smtpname some.mailbox@gmail.com \
    -u username \
    --auth password \
    -r "Inbox.folder1","Inbox.folder2","Inbox.etc" \
    -v mailserver.domain.com

... with the "Inbox" representing the home "Maildir" path
and the "Inbox.folder1" representing the first named sub-folder
within the main maildir... and "Inbox.folder2" the 2nd, etc.

-- 
Tyler Nally
tnally@technally.com

Re: using LearnAsSpam IMAP folder

Posted by Pollywog <li...@shadypond.com>.
On 12/04/2005 10:48 pm, Tyler Nally wrote:
> On Sunday 04 December 2005 05:08 pm, Pollywog wrote:
> > That did not do it, but I think you are close, that is is something along
> > those lines.  I think the instructions I followed are not intended for
> > Courier but for Cyrus.
>
> I user Courier on this particular server .. and for
> sa-learn to harvest spam out of a Courier/IMAP Maildir
> folder (because all Courier Maildir folders (regardless
> of whether it's the main "Maildir" or one of the subfolders)
> has a "cur" "tmp" and "new" subfolders ... this is what I
> have to do.

I do that as well and have no problem, but when I use the fetchmail as shown 
at the URL I posted (the command goes into a crontab), fetchmail can't find 
the IMAP folder.

>
> I use a similar mechanism where I keep track of the different
> Ham and Spam folder names... and I use two different scripts
> to sweep through the file system with a HAM sweep (going through
> all of the cur, tmp, & new named sub-folders that are known to
> have HAM in them.... and another script that is setup to sweeep
> through the cur, tmp, & new SPAM sub-folders.
>
> This is what most of my HAM folders sa-learning script looks like:


I think I might have to do something similar, because I can't get this other 
method to work.  It sure would be nice to just drop the spams in the 
"LearnAsSpam" folder and forget about them, though.

8)

Re: using LearnAsSpam IMAP folder

Posted by Tyler Nally <tn...@technally.com>.
On Sunday 04 December 2005 05:08 pm, Pollywog wrote:

> That did not do it, but I think you are close, that is is something along
> those lines.  I think the instructions I followed are not intended for
> Courier but for Cyrus.

I user Courier on this particular server .. and for
sa-learn to harvest spam out of a Courier/IMAP Maildir
folder (because all Courier Maildir folders (regardless
of whether it's the main "Maildir" or one of the subfolders)
has a "cur" "tmp" and "new" subfolders ... this is what I 
have to do.

I use a similar mechanism where I keep track of the different
Ham and Spam folder names... and I use two different scripts
to sweep through the file system with a HAM sweep (going through
all of the cur, tmp, & new named sub-folders that are known to
have HAM in them.... and another script that is setup to sweeep
through the cur, tmp, & new SPAM sub-folders.

This is what most of my HAM folders sa-learning script looks like:

##----NOTES-------------------
$WORKDIR is the path of the main maildir (inbox) that sa-learn
is processing.  $DIRFILE is the name of the file that contains
the list of named sub-folders of the main Maildir.  $SALEARN is
the variable that contains the full path to sa-learn.  And since
this particular e-mail system is fully database driven, "vmail"
is the account of the virtual-mail while e-mail is processed.
##----------------------------

OUTPUT="$WORKDIR/hamfolder.out"  # captures standard output output
WIPPUT="$WORKDIR/hamfolder.wip"  # captures current work-in-progress
ERRPUT="$WORKDIR/hamfolder.err"  # captures standard error output
WORKFIL="$WORKDIR/hamfolder.do"  # captures current named sub-folder

for OUTFILE in `echo $OUTPUT $WIPPUT $ERRPUT $WORKFIL`
do
    if [ -e "$OUTFILE" ]
    then
        echo "erasing $OUTFILE"
        rm $OUTFILE
    fi
done


DATE=`date`

OFLD="tmp cur new"

for FOLDERIN in `cat $DIRFILE`
do
  for SUBFLDR in $OFLD
     do
       echo "$DIRPATH/$FOLDERIN/$SUBFLDR" > folder.do
       echo "---- $DIRPATH/$FOLDERIN/$SUBFLDR -----" >> $WIPPUT
       echo "---- $DIRPATH/$FOLDERIN/$SUBFLDR -----" >> $ERRPUT
       echo "---- $DIRPATH/$FOLDERIN/$SUBFLDR -----" >> $OUTPUT
       nice  $SALEARN -u vmail --showdots --ham --folders=folder.do >> $OUTPUT 
2>>$ERRPUT
       DATE=`date`
       echo "--DONE w/ $DIRPATH/$FOLDERIN/$SUBFLDR --" >> $WIPPUT
       echo "--DONE w/ $DIRPATH/$FOLDERIN/$SUBFLDR --" >> $ERRPUT
       echo "--DONE w/ $DIRPATH/$FOLDERIN/$SUBFLDR --" >> $OUTPUT
    done
done
echo "+-------------------------+" >> $OUTPUT
echo "|                         |" >> $OUTPUT
echo "|   Learning about HAM    |" >> $OUTPUT
echo "|                         |" >> $OUTPUT
echo "|          DONE           |" >> $OUTPUT
echo "|                         |" >> $OUTPUT
echo "+-------------------------+" >> $OUTPUT


The main difference between HAM and SPAM processing is the "--ham" is 
changed to "--spam" in the sa-learn execution..... and where you see 
"ham" or "HAM" in the different variable file names.. they are changed
to "spam" or "SPAM" accordingly as well.

-- 
Tyler Nally
tnally@technally.com

Re: using LearnAsSpam IMAP folder

Posted by Pollywog <li...@shadypond.com>.
On 12/04/2005 09:55 pm, Tyler Nally wrote:
> On Sunday 04 December 2005 03:29 pm, Pollywog wrote:
> > I forgot one thing that might be important: I am using Courier IMAP, not
> > Cyrus
> >
> > courier-imap   3.0.8-4
> > courier-maildrop 0.47-4
>
> Courier doesn't put the e-mail *directly* into the folder that
> carries the folder's name, but one of three directories "cur",
> "tmp", or "new" inside of the named folder.... so, if you
> have a folder... "LearnAsSpam" inside of your inbox (Maildir/),
> the path (I think) you'd need is...
>
>    $HOME/Maildir/.LearnAsSpam/cur/
>
> .. for the value that a sa-learn would have to be aimed towards
> to pick up the contents thereof.

That did not do it, but I think you are close, that is is something along 
those lines.  I think the instructions I followed are not intended for 
Courier but for Cyrus.

thanks

8)


Re: using LearnAsSpam IMAP folder

Posted by Tyler Nally <tn...@technally.com>.
On Sunday 04 December 2005 03:29 pm, Pollywog wrote:

> I forgot one thing that might be important: I am using Courier IMAP, not
> Cyrus
>
> courier-imap   3.0.8-4
> courier-maildrop 0.47-4

Courier doesn't put the e-mail *directly* into the folder that 
carries the folder's name, but one of three directories "cur",
"tmp", or "new" inside of the named folder.... so, if you
have a folder... "LearnAsSpam" inside of your inbox (Maildir/), 
the path (I think) you'd need is...

   $HOME/Maildir/.LearnAsSpam/cur/

.. for the value that a sa-learn would have to be aimed towards
to pick up the contents thereof.

-- 
Tyler Nally
tnally@technally.com

Re: using LearnAsSpam IMAP folder

Posted by Pollywog <li...@shadypond.com>.
On 12/04/2005 08:16 pm, Pollywog wrote:
> I am running Spamassassin 3.0.2 and Fetchmail 6.2.5 on Xandros, which is
> similar to Debian "Sarge".
>
> I followed the directions in the Spamassassin wiki at
> http://wiki.apache.org/spamassassin/SingleUserUnixInstall
> under the section "Enable IMAP LearnAsSpam folder".
>
> The problem is that no matter how I specify the IMAP folder, as
> "LearnAsSpam" (without quotes), "Maildir/.LearnAsSpam" etc, fetchmail is
> unable to find the IMAP folder.  I am using kmail to create the folder and
> no matter where I put the folder, fetchmail cannot find it.
>
> Has anyone done this successfully with kmail?  I also have Thunderbird and
> I could use that.

I forgot one thing that might be important: I am using Courier IMAP, not Cyrus

courier-imap   3.0.8-4
courier-maildrop 0.47-4


8)