12,290
edits
This is the support site for Andrews & Arnold Ltd, a UK Internet provider. Information on these pages is generally for our customers but may be useful to others, enjoy!
mNo edit summary |
m (→Sieve filter) |
||
(8 intermediate revisions by 3 users not shown) | |||
me-amazon@example.com
me-ebay@example.com
...
me-ANYTHING@example.com
or the other way around, if you preferred:
ebay-me@example.com
amazon-me@example.com
...
ANYTHING-me@example.com
You also want this to be flexible and work as a 'catch-all' for any addresses you have as your suffix or prefix - you don't want to have to log in to the control page each time you want to create a new prefix/suffix.
(you can also use a '''+''' instead of a '''-''' if you wanted to - just alter the settings appropriately below)
This is all possible with two things:
==Alias==
Once messages are being sent to your Inbox with the alias above, you can create a sieve filter to automatically move messages to their folder, if you've made the folder already.
<syntaxhighlight lang="sieve">
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;}
</syntaxhighlight>
===Variations===
You can create the folders automatically if you wanted add :create, - but some mail clients won't refresh their folder list until they are restarted. We also title case the new folder name - eg it will be called Amazon (capital A).
<syntaxhighlight lang="sieve">
set :upperfirst "suffix" "${1}";
fileinto :create "INBOX.Filtered.${suffix}";
</syntaxhighlight>
If you're using a + rather than a - to separate the suffix, then adjust the regex in the sieve filter above to be like:
<syntaxhighlight lang="sieve">
if header :regex "X-Delivered-To" "\\+([A-z0-9]+)@" {
</syntaxhighlight>
== Create the folders ==
[[File:Email folders.png|thumb|none|100|Folder layout in your email client]]
[[Category:Sieve]]
|
edits