Sieve-Example:Move email to a suffix folder: Difference between revisions

From AAISP Support Site
mNo edit summary
Line 2: Line 2:
Say you have a single mailbox:
Say you have a single mailbox:
me@example.com
me@example.com

And you want to give out 'unique' addresses to companies so that you can control who has your address and helps you track and filter your email. You may want to give out addresses such as:
me-amazon@example.com
me-ebay@example.com

This is all possible with two things:
*An alias - set on the Control Pages
*A sive filter

==Alias==
On the control pages, in the email setup, under aliases create an alias such as:
[[File:Email alias for suffix.png|thumb]]

==Sieve filter==

<syntaxhighlight>




require ["fileinto","imap4flags","variables","regex","mailbox"];

## filter messages sent to an address with a suffix eg, me-amazon@example.org.uk in to a folder called amazon if it exists.
if exists "X-Delivered-To" {

if header :regex "X-Delivered-To" "me-([A-z0-9]+)@" {
set :lower "suffix" "${1}";
fileinto "INBOX.Filtered.${suffix}";
}
stop;}
</syntaxhighlight>

== Create folder ==
The sieve filter puts email in to a folder called Filtered/XXX, and as long as XXX matches the suffix in the email address, the messages will get moved to there.

Revision as of 13:24, 14 February 2019

description

Say you have a single mailbox:

me@example.com

And you want to give out 'unique' addresses to companies so that you can control who has your address and helps you track and filter your email. You may want to give out addresses such as:

me-amazon@example.com
me-ebay@example.com

This is all possible with two things:

  • An alias - set on the Control Pages
  • A sive filter

Alias

On the control pages, in the email setup, under aliases create an alias such as:

Email alias for suffix.png

Sieve filter

require ["fileinto","imap4flags","variables","regex","mailbox"];

## filter messages sent to an address with a suffix eg, me-amazon@example.org.uk in to a folder called amazon if it exists.
if exists "X-Delivered-To" {

         if header :regex "X-Delivered-To" "me-([A-z0-9]+)@" {
                set :lower "suffix" "${1}";
                fileinto "INBOX.Filtered.${suffix}";
        } 
        stop;}

Create folder

The sieve filter puts email in to a folder called Filtered/XXX, and as long as XXX matches the suffix in the email address, the messages will get moved to there.