Thanks to all that did, I've now had it sit there and work... just about to bolt it into amavis and see what happens! For anyone intested, the think I'm playing with is available from: http://sourceforge.net/project/showfiles.php?group_id=10590
Thanks,
Brett Parker