Your own Sieve rules
The filters in the portal cover most needs — see Filters and rules. If you want to write rules yourself, you can do so in Sieve, the filtering language standardised in RFC 5228. Your script runs on the server at delivery time, together with the rules from the portal — whichever app you read in.
How to connect
| Setting | Value |
|---|---|
| Server | imap.onmeil.eu |
| Port | 4190 |
| Encryption | STARTTLS |
| Username | your full email address |
| Password | an app password |
App password, not your normal password
Sieve tools sign in with an app password, just like mail clients do. Your normal sign-in password does not work here.
Tools that work: the Sieve add-on for Thunderbird, the command-line tool sieve-connect, and any other client that speaks ManageSieve.
How to do it in practice
In Thunderbird (easiest)
- Install the Sieve add-on (Tools → Add-ons → search «Sieve»).
- Right-click your account → Sieve Message Filters.
- The add-on usually finds the server itself. Otherwise:
imap.onmeil.eu, port4190, STARTTLS. - Sign in with your app password.
- Create a new script, name it
personal, write your rules and save. It runs from then on.
On the command line with sieve-connect
Good if you want to version-control or automate your rules. The three commands list your scripts, download the portal's meil so you can see the format, and upload your own as personal:
sieve-connect -s imap.onmeil.eu -u you@onmeil.eu --list
sieve-connect -s imap.onmeil.eu -u you@onmeil.eu --remotesieve meil --localsieve meil.siv --download
sieve-connect -s imap.onmeil.eu -u you@onmeil.eu --remotesieve personal --localsieve personal.siv --uploadThe tool asks for the app password and uses STARTTLS automatically on 4190.
Your script is called personal
Read this before you upload
You have two scripts. Ours is called meil and holds the rules you set in the portal; it is rewritten every time you save there. Yours is called personal, and we never touch it. You do not need to make it active — ours calls yours before all the portal rules either way. Three things still happen before yours, and a stop in your script does not stop them: mail to an address you have paused is refused, the forwarding you set up happens, and your out-of-office reply is sent. End your script with stop; if it alone should decide — then neither your portal rules nor the routing of your hidden addresses runs afterwards. If you want the mail to stay in your inbox, end with keep;. Do neither, and a portal rule may move the message to another folder, even when your own script only set a flag or did nothing at all. A script that cannot be parsed is refused the moment you upload it, with a line number — it can never stop your mail.
What runs, in order
- Forwarding you have set up
- Refusal of addresses you have paused
- Your out-of-office reply
- Your script —
personal - Routing of hidden addresses to their folders
- Your rules from the portal
A stop; in your script stops 5 and 6. It never stops 1–3.
stop; or keep; — choose deliberately
A script that only sets a flag, with no keep;, fileinto or stop;, looks safe — but as soon as a portal rule moves the message, it is gone from your inbox. If you want the mail to stay, end with keep;. It then lands in your inbox and wherever the portal rule files it.
require ["fileinto", "mailbox"];
if header :contains "subject" "nyhetsbrev" {
fileinto :create "Nyhetsbrev";
stop;
}
keep;If only your script should decide, end with stop; instead of keep;.
Examples
Archive mail from several senders (OR):
require ["fileinto", "mailbox"];
if anyof (address :is "from" "styret@example.com",
address :is "from" "regnskap@example.com") {
fileinto :create "Viktig";
}A flag and a folder in one:
require ["imap4flags", "fileinto", "mailbox"];
if header :contains "list-id" "announce.example.com" {
addflag "\\Seen";
fileinto :create "Lister";
}addflag sets an IMAP flag or keyword: \\Seen marks as read, \\Flagged stars the message, and a word of your own (for example Nyhetsbrev) becomes a keyword that most clients show as a label. To use a label you created in the meil portal, the easiest way is to set it with a portal rule.
Errors in the script
A script that cannot be parsed is refused the moment you upload it — with a line number. It never becomes active, and it can never stop your mail.
See also
- Filters and rules — the rules you set in the portal
- App password
- RFC 5228 — Sieve
- RFC 5232 — imap4flags (flags and labels)