When rejecting emails that are classified as spam by whatever means, there's always the chance of false positives. On the other hand, when accepting emails that may be spam and dumping them into a spam folder the owner of the mailbox might not check that folder and miss an important email while the sender assumes it has been delivered.
I think the perfect solution for this would be to reject the email as far as the sender is concerned but still deliver it to a spam folder.
So my questions are:
- Is it possible/allowed for an SMTP server (as far as the SMTP protocol and related RFCs are concerned) to reject an email after receiving everything (i.e. all header and the full message body) without errors?
- Is it possible to achieve this behavior with Postfix, ideally without having to modify its code.
As you seen in the comments, bad idea. Microsoft has attempted to use this as a way to prevent email harvesting, they reject the emails at the DATA entry instead of at the FROM/TO, causing a lot of headaches for those of us that put exchange behind a spam filter. (Enter Backscatter)
SMTP Reject is the only way to properly reject emails, if you do not reject at the SMTP level you must accept and store/drop the message, ALSO, if you reject at this level it would be based on Domain/IP Reputation, not content. The server reputation is not your problem.
Technically possible. Would be less convenient.
Your design is in error here: "[after seeing SMTP OK] the sender assumes it has been delivered". Not true on two levels. First of all, the goal is always to be actually read by a human recipient, not only getting onto their disk. Secondly, there is no SMTP OK today, really. Your design doesn't change that. When the servers say "OK" they don't mean that; they mean: "I can't say if a human will read this mail or not; see ya".
Now at least SMTP reject means true reject. The main effect of your change is changing SMTP reject to mean "I can't say if a human will read this mail or not; chances are bad; see ya". And that's about the same as SMTP OK, just with a slightly negative tone.
To sum up the changes as perceived by humans:
What changes for a recipient: