Adds a "Spam management" panel to Settings for choosing what happens to mail
flagged by your spam filter (via the X-Spam-Flag header): leave it alone,
move it to Trash, or file it into the Spam folder.
A dedicated panel appears in the Settings sidebar alongside Filters. Three options are available:
- Do nothing — flagged mail is delivered normally.
- Move to Trash — flagged mail is filed into
Trashto prevent complete mail loss. - Move to Spam — flagged mail is filed into
Spam.
Changes are written to the Sieve server when you click Save.
The plugin manages exactly one rule named "Spam management" in the user's active Sieve script:
# rule:[Spam management]
if header :is :all "X-Spam-Flag" "YES"
{
fileinto :create "INBOX.Spam";
stop;
}
Because the rule uses the standard # rule:[name] marker, it is also visible
and editable in the regular Filters UI.
When "Do nothing" is selected, the rule is removed from the script entirely.
Filing into a folder that doesn't exist yet fails at delivery time unless the
Sieve script uses the mailbox extension's :create modifier. The
managesieve plugin's own script compiler does not support :create,
so this plugin compiles the script normally and then patches the resulting text itself:
- adds
require "mailbox";if not already present, and - adds
:createto thefileintoinside this plugin's own rule block only.
Failures are always logged to logs/spam_manager_debug. Verbose step-by-step
logging (save requests, the patched script text, extension support) is only
written when $config['spam_manager_debug'] = true; is set.