Note: This only works for the Debian packages, which includes libsieve-dev-2.1.7 from Dec2005.
This is just a quick and dirty how-to, since the feature is not (yet) documented elsewhere.
Let's assume we have amavisd-new with SpamAssassin and want our tagged mail to go into INBOX/Spam. Our user ID is 1. Spam is tagged with **
*SPAM*
*
* in the subject line.
This is pretty straightforward:
INSERT INTO dbmail_filters (user_id, filter_id, filter_field, filter_value, mailbox) VALUES (1, 0, 'Subject', '***SPAM***', 'INBOX/Spam');
As far as I know, filter_id needs not to be set.
A (probably better) alternative is to check for X-Spam-Flag:
INSERT INTO dbmail_filters (user_id, filter_id, filter_field, filter_value, mailbox) VALUES (1, 0, 'X-Spam-Flag', 'YES', 'INBOX/Spam');