http://undeadly.org/cgi?action=article&sid=20130130081741
OpenSMTPD has had filters for over a year now, but disabled as the API is not stable and there were more important stuff to deal with.
Filters in OpenSMTPD are standalone programs that are linked against a lib we provide to demonize and provide an event-based callback mechanism.
The filters can be very very easy and an example of a working filter could be as simple as:
void
mail_cb(uint64_t id, struct filter_mail *p, void *arg)
{
/* block idiots */
if (! strcmp(p->domain, "0pointer.net")) {
filter_api_reject(id, 530, "You're not welcome, go away !");
return;
}
filter_api_accept(id);
}