Rather than a custom plugin, I think you are looking for a custom wrapper around SA. People have written such things for blog software, which would not be too much different from your use. You could probably also do some creative routing to run the mail through spamd and get a result back. Obviously you want to know the classification result, since (I presume) you don't want to send the message it if appears to be spam.
Loren