You can run SpamAssassin at SMTP time in the DATA phase. At least, you can with both Exim and Postfix. I assume other MTA's support that too. You can run Greylisting at the same stage after SpamAssassin has been run and before the message has been accepted.