Sieve-Example:Move email to a suffix folder: Difference between revisions
m (→Alias) |
m (→Sieve filter) |
||
Line 19: | Line 19: | ||
==Sieve filter== |
==Sieve filter== |
||
Once messages are being sent to your Inbox, we create a sieve filter to automatically move messages to their folder, if it has been made. If the folder hasn't been made, then they will be put in to your Inbox as normal. |
|||
<syntaxhighlight> |
<syntaxhighlight> |
||
require ["fileinto","imap4flags","variables","regex","mailbox"]; |
require ["fileinto","imap4flags","variables","regex","mailbox"]; |
||
## |
## Move messages sent to an address with a suffix eg, me-amazon@example.com in to a folder called Filtered/amazon, if it exists. |
||
if exists "X-Delivered-To" { |
if exists "X-Delivered-To" { |
||
Line 32: | Line 33: | ||
stop;} |
stop;} |
||
</syntaxhighlight> |
</syntaxhighlight> |
||
This filter uses the 'X-Delivered-To' header which is added by the A&A mail servers - even if you are BCC'd then the filtering will work. The X-Delivered-To is the 'envelope-to' header, which is the address the email was actually sent to by the sender. |
|||
*You'll need to add this sieve filter - eg by using the (latest) Thunderbird Sieve extension, see [https://support.aa.net.uk/Sieve_Filtering#Sieve_Server_Settings Sieve_Server_Settings] for info in the 'Creating Sieve Filters' section |
*You'll need to add this sieve filter - eg by using the (latest) Thunderbird Sieve extension, see [https://support.aa.net.uk/Sieve_Filtering#Sieve_Server_Settings Sieve_Server_Settings] for info in the 'Creating Sieve Filters' section |
Revision as of 15:23, 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 sieve filter
Alias
On the control pages, in the email setup, under aliases create an alias such as:
This sends messages addressed to me-ANYTHING@example.com to the me Mailbox
Sieve filter
Once messages are being sent to your Inbox, we create a sieve filter to automatically move messages to their folder, if it has been made. If the folder hasn't been made, then they will be put in to your Inbox as normal.
require ["fileinto","imap4flags","variables","regex","mailbox"];
## Move messages sent to an address with a suffix eg, me-amazon@example.com in to a folder called Filtered/amazon, if it exists.
if exists "X-Delivered-To" {
if header :regex "X-Delivered-To" "-([A-z0-9]+)@" {
set "suffix" "${1}";
fileinto "INBOX.Filtered.${suffix}";
}
stop;}
This filter uses the 'X-Delivered-To' header which is added by the A&A mail servers - even if you are BCC'd then the filtering will work. The X-Delivered-To is the 'envelope-to' header, which is the address the email was actually sent to by the sender.
- You'll need to add this sieve filter - eg by using the (latest) Thunderbird Sieve extension, see Sieve_Server_Settings for info in the 'Creating Sieve Filters' section
- This won't be able to be added via Roundcube, as you can't paste in raw sieve code there.
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. So,
- create a folder called: Filtered
- create folders within Filtered for the suffix you want filtered there