Skip to content

Psych0meter/roundcube-spam_manager

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

spam_manager — Roundcube plugin

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.


What it does

Settings panel

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 Trash to prevent complete mail loss.
  • Move to Spam — flagged mail is filed into Spam.

Changes are written to the Sieve server when you click Save.

Sieve rule

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.

The :create modifier

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:

  1. adds require "mailbox"; if not already present, and
  2. adds :create to the fileinto inside this plugin's own rule block only.

Logging

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.

About

Roundcube plugin — manage a Sieve rule to redirect spam

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors