Stephen Gran on 8 Sep 2004 23:39:03 -0000

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] Using fetchmail to read from an Exchange public folder for learning spam

On Wed, Sep 08, 2004 at 11:52:46AM -0400, Mike Leone said:
> /usr/bin/fetchmail -a -s -n -p IMAP --folder 'INBOX.Learn Spam' -m 'bash -c
> "/usr/bin/tee >(/usr/bin/sa-learn --spam --single \ 
>                  > /dev/null)|/usr/bin/spamc|/usr/lib/cyrus-imapd/deliver

So it does this:
Runs fetchmail, and fetches all (-a) mail in (-s) silent mode (no running
ouput).  It uses norewrite (-n), to keep the headers intact, so that
SA gets them as is.  Then it spawns a subshell as a delivery agent with
the -m option.  The subshell uses tee to cat to stdout everything coming
from fetchmail, and tee's output goes to sa-learn.  He is then delivering
the mail to his cyrus account, although you won't want to do that.

> but am unclear how to adapt this to my purposes. For instance, where is this
> "INBOX.Learn spam" folder in this command - in an IMAP server? So in my
> case, it would be my "Uncaught Spam" folder? 


> - fetchmail isn't actuallY fetching the mail, so it's just reading the
> contents of a folder, and then running a command on what it finds there?
> - And it does that for every new piece of mail in that folder?


> And I would want:
> /usr/bin/fetchmail -a -s -n -p IMAP --folder '???????' -m 'bash -c
> "/usr/bin/tee >(/usr/bin/sa-learn --spam --single > /dev/null)"'
> exchange-server
> (the '?????' are because I'm not sure how to specify the folder name)

Well, what's the folder name?  Is it even served via IMAP?

> I'm not sure how the "tee" comes into play. I've read the man page, but it's
> still not clicking.


> And what of a username and password, to access the Exchnage server? I have
> one, obviously, for this spam account, but where and how do I use it, with
> fetchmail like this?

man fetchmail says -u for username, and read the section titled 'USER
AUTHENTICATION AND ENCRYPTION' for password information.

|  Stephen Gran                  | Four fifths of the perjury in the world |
|             | is expended on tombstones, women and    |
| | competitors.   -- Lord Thomas Dewar     |

Attachment: pgpAwSkEm8d8o.pgp
Description: PGP signature