Greenlisting with Sieve

As I've written about in many places, one of the keys to separating spam from non-spam is to greenlist your known correspondents. Using a greenlist will minimize your false positives and turn your MaybeSpam box into an AlmostCertainlySpam box.

Since Sieve is a standard filtering language (RFC 3028 and 3028bis) and I try to use standards whenever possible, I'm converting my Procmail recipes to Sieve scripts. Here is the Sieve script I use to deliver email from my greenlisted correspondents to my primary inbox.
require ["imapflags", "fileinto"];
if address "From" ["", "", ""] {
addflag "Green";
fileinto "INBOX";

## Comment 1: The if test also uses the :all :is :comparator "i;ascii-casemap"
## arguments, which are the default arguments for header comparisons. For clarity,
## you may want to explicitly specify some or all of these default arguments.

## Comment 2: You might want to use ["From", "Sender", "Resent-From", "Reply-To"]
## instead of "From" in the if test.
As you can see, this script also sets the Green IMAP keyword on my incoming greenlisted messages. I set this keyword because I have my IMAP clients set up to color these messages green (of course!). This helps me to manage my email and also serves as a reminder about which addresses I need to add to my greenlist (i.e., the ones that don't have the Green keyword set).

To optimize my Sieve filtering, I do not pass solicited-bulk-email (SBE) messages to the greenlist script. Here is one way to do this optimization.
require "include";
if not header :is "Precedence" ["bulk", "list"] {
include :personal "greenlist";

## Comment: The :is argument is not needed because it is used by default,
## but, for clarity, I have explicitly used it in this script.
This is not perfect because not all SBE messages include a Precedence: bulk or Precedence: list header, but enough do that this provides a pretty good optimization.

Note that not all providers support the Sieve include extension that I use in the second script, but it is very useful if they do. The include extension makes it possible to compartmentalize your Sieve scripts and easily plug in, unplug, and edit various scripts. For example, you can use it to plug in the ingo Sieve script [*] that is generated by the Horde/Ingo web-based Sieve manager, or to plug in greenlists & bluelists [**] that you maintain on external systems and upload via the ManageSieve protocol.

To learn more about Sieve, see the Sieve section of my portal in the sidebar.

[*] For an example of a Sieve script that includes ("plugs in") an ingo script, see Greenlisting at Tuffmail.

[**] I use a script named bluelist to accept and deliver my solicited bulk email (mailing lists, newsletters, feeds that I receive via email, etc.).

Hashtag: # [?]

Post & Read Comments (located elsewhere)



Post & Read Comments (located here)


How do you actually do this in Tuffmail? There doesn't seem to be any way to access the whitelist maintained by one of the webmail clients from a custom Sieve script, and my limited knowledge of Sieve suggests that it is not very suitable for trying to build and maintain whitelists.

I have been very interested in your thoughts on email processing, but I'm not sure that your ideas could actually be implemented by users of a system like Tuffmail, where you don't have the ability to run general shell scripts.


Hi Rick, this can actually be implemented at Tuffmail, although it's not obvious how to do it. I posted a new blog item called Greenlisting at Tuffmail that describes how I do this at Tuffmail. Please post in that blog item if you have any questions or comments about greenlisting at Tuffmail.


Post a Comment



Links to this page

Create a Link



Each item © Nancy McGough
Each comment © the author of the comment web site hosted by
deflexions powered by Delicious · reflexions powered by Blogger
More deflexions & reflexions, & feeds available via the sidebar top & bottom

[link] For bookmarks & links, please use this page's permalink [link]