Dunno about easiest, but best I'd recommend
one that encourages people not to top-post.
The Java API has a nice mail system. If you are only a little familiar
with the the basic java.net.* framework, you can work with this to provide
the mail retrieving and sending functionality. Since Java is Object
Oriented, the mail when retrieved can be interpreted as an object. So,
when you access the mail, you can read the sender, topic, and body without
deleting it from the server. Basically, its all about Black List, and
White List filter (check google for what they mean). You can integrate
those into a program that, when a message is retrieved from the server,
you can seperate them into spam, might be spam, and not spam, then filter
them to 3 different mail boxes.
Since you are designing a "plug in" to a mail program, or looking for a
program that will take java plugins, you would be looking for a while. It
would be alot easier to design a program that would send the 3 types of
mail to each box. Also, this would be alot easier to implement in linux,
as you can run ANYTHING you want in command line.
Basically, it sounds like a nice project. good luck
me