1000 FAQs, 500 tutorials and explanatory videos. Here, there are only solutions!
Sort incoming emails according to rules (Sieve filters)
This guide explains how to create sorting rules to automatically categorize your incoming emails on Infomaniak based on certain conditions.
⚠ Available with:
kSuite | Free | * |
Standard | ||
Business | ||
Enterprise | ||
my kSuite | * | |
my kSuite+ | ||
Mail Service | Starter 1 max. address | * |
Premium 5 min. addresses |
* advanced (expert) mode unavailable
Preamble
- These rules allow the following automatic actions:
- Delete or move messages from email addresses you no longer want to see.
- Forward to your spouse the emails from an email address so that you both receive them.
- Copy messages containing a specific keyword to a folder.
- etc.
- Unlike the sorting rules offered within email software/clients (Microsoft Outlook, Mozilla Thunderbird, Apple Mail...), these rules will act directly on the server of your mailboxes before even the IMAP connection.
- You can make a template for all the addresses of your Mail Service.
- If you use an email software/client configured in POP, in parallel with Mail Infomaniak, the messages sorted into folders will no longer be downloaded by your application because the POP protocol only retrieves the messages that are in your main inbox. To view the sorted messages, it will be necessary to use the IMAP protocol or Mail only.
Access the rules from the Infomaniak Web Mail app
Prerequisites
- Permission to manage rules: if you had been invited to the Mail Infomaniak Web app (online service ksuite.infomaniak.com/mail) to manage your address, it is possible that the Mail Service manager has removed this right from their admin account.
To access the sorting filters for your Infomaniak mailbox:
- Click here to access the Mail Infomaniak Web app (online service ksuite.infomaniak.com/mail).
- Click on the Settings icon in the top right corner.
- Check or select the email address concerned in the dropdown menu.
- Click on Filters and rules:
Define a rule based on a received email
You can also create a rule directly from the received email:
- Click here to access the Mail Infomaniak Web app (online service ksuite.infomaniak.com/mail).
- Open the message from the sender concerned.
- Click on the action menu ⋮ in the top right corner of the open message.
- Choose Create a rule to open the creation assistant which will be pre-filled with the elements of the message:
Access rules from the Mail Service
To access the sorting filters for your Infomaniak mailbox:
- Click here to access the management of your product on the Infomaniak Manager (need help?).
- Click directly on the name assigned to the product concerned.
- Click on the email address concerned in the table that appears.
- Click on the Filters and rules tab from the left sidebar:
Configure sorting filters & rules
Create a new rule in Standard mode
- Click on the Add a rule button in Standard mode to create a new rule using a creation assistant/form:
- The different conditions available for sorting filters are presented in this other guide.
- Once a filter is created, click on Continue to activate it.
Add or modify a rule in Standard mode
If there are already sorting filters, the button to add more is at the top right of the table:
These settings can be modified at any time by clicking on the pencil icon ✎ located to the right of the concerned element.
Create a new rule in Advanced (expert) mode
Read the prerequisites
If you don't know what you're doing, it is recommended to stay in Standard mode so as not to disrupt the sorting filters of your account ⚠️ No support is provided regarding the Sieve language (refer to this documentation — also discover the role of the host).
- The advanced mode allows you to configure sorting rules directly from a script in Sieve language.
- It is possible to import Sieve files via the button.
- By activating this mode, the existing rules will be kept but deactivated.
First example of advanced sorting
Here is a simple example of a command using this language:
require ["fileinto"];
if address :contains "from" "facebook.com" {
fileinto "fb";
} elsif header :matches "List-Unsubscribe" "*" {
fileinto "nl";
} else {
keep;
}
Explanations:
- Loading required extensions: use
require ["fileinto"];
to indicate that you will use thefileinto
function. - Filtering Facebook messages: use
if address :contains "from" "facebook.com"
to check if the sender's address contains "facebook.com"; if so, the message is filed in the "fb" folder withfileinto "fb";
. - Filtering messages with an unsubscribe link: use
elsif header :matches "List-Unsubscribe" "*"
to check if the "List-Unsubscribe" header is present in the message; if so, the message is filed in the "nl" folder withfileinto "nl";
. - Keeping other messages: use
else { keep; }
to keep all other messages that do not match the previous criteria.
Warning:
- If you need to mention a subfolder, use the separator
/
(as in the second example), but it is not necessary to specifyINBOX
in your codes - Make sure that the folders
"fb"
and"nl"
already exist in your inbox; otherwise, the messages may not be sorted correctly - The filter
address :contains "from" "facebook.com"
works correctly for addresses that contain "facebook.com" in the "from" field - The filter
header :matches "List-Unsubscribe" "*"
checks only for the presence of the "List-Unsubscribe" header, not its content
Second example of advanced sorting
This code modifies the subject based on thesender (adds a prefix to the subject when an email passes the filter, for example):
require ["fileinto", "editheader", "variables", "regex"];
if address "sender" "owner-scientific-linux-devel at LISTSERV.FNAL.GOV" {
if header :regex "subject" "((Re|Fwd): *)\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)" {
deleteheader "Subject";
addheader "Subject" "${1}${3}";
} else {
# Ajouter un préfixe si l'objet ne correspond pas déjà au modèle
deleteheader "Subject";
addheader "Subject" "[SL-Devel] ${1}";
}
fileinto "Mail List/SL-Devel";
}
Explanations:
- Required extensions:
fileinto
: to sort messages into folders.editheader
: to modify email headers.variables
: to use variables in expressions.regex
: for regular expressions.
- Condition on the sender:
if address "sender" "owner-scientific-linux-devel at LISTSERV.FNAL.GOV"
: checks if the sender matches.
- Condition on the subject:
if header :regex "subject" "((Re|Fwd): *)\\[SCIENTIFIC-LINUX-DEVEL\\] *(.*)"
: checks if the subject matches the specified pattern.deleteheader "Subject";
andaddheader "Subject" "${1}${3}";
: removes the existing subject and adds a new subject with the captured parts.
- Adding a prefix if the subject does not already match the pattern:
addheader "Subject" "[SL-Devel] ${1}";
: adds a prefix "[SL-Devel]" to the subject if it is not already present.
- Sorting the message:
fileinto "Mail List/SL-Devel";
: sorts messages into the "Mail List/SL-Devel" folder.
Warning:
- Make sure the folder
Mail List/SL-Devel
already exists in your inbox. - Check that the script correctly modifies the subject of emails to add or adjust the prefix if necessary.