SIEVE
SIEVE
Le Sieve est un langage de filtrage du courrier électronique. Il permet de filtrer les en-têtes d'un message. Il peut vous être utile sur certaines messageries comme Infomaniak. (RFC 5228).
Voici quelques exemple de fonctionnalités: (foo.me représente votre domaine de messagerie).
A la réception pour certains destinataires, envoi d'une notification mail et suppression du mail. Utile pour ceux qui font du catchall.
require ["editheader", "variables", "copy", "fileinto", "imap4flags", "enotify"];
if anyof (address :matches "To" "audi-connecttion@foo.me", address :matches "To" "lastfm@foo.me")
{
set "vto" "${1}";
discard;
set "vmailto" "jean.dujardin@foo.me";
set :encodeurl "body_param" "⚠️ Un mail supprimé suivant vos règles
A : ${vto}
Le mail a été automatiquement supprimé.";
notify :from "noreply@foo.me" :importance "1" :message "⚠ [discard] Un mail supprimé suivant vos règles" "mailto:${vmailto}?body=${body_param}";
stop;
}
A la réception de certains émetteurs, envoi d'une notification mail et suppression du mail.
require ["editheader", "variables", "copy", "fileinto", "imap4flags", "enotify"];
if anyof (address :matches "From" "superspameur@outlook.me", address :matches "From" "lastfm@gmail.co")
{
set "vto" "${1}";
discard;
set "vmailto" "jean.dujardin@foo.me";
set :encodeurl "body_param" "⚠️ Un mail supprimé suivant vos règles
A : ${vto}
Le mail a été automatiquement supprimé.";
notify :from "noreply@foo.me" :importance "1" :message "⚠ [discard] Un mail supprimé suivant vos règles" "mailto:${vmailto}?body=${body_param}";
stop;}
require ["editheader", "variables", "copy", "fileinto", "imap4flags", "enotify"];
if allof (header :matches "x-infomaniak-spam" "spam", not address :matches "from" "noreply@foo.me")
{
if header :matches "Subject" "*"
{
set "subject" "${1}";
if header :matches "from" "*"
{
set "sender" "${1}";
deleteheader "Subject";
addheader :last "Subject" "⛔ ${subject}";
fileinto "Spam";
set "vmailto" "jean.dujardin@foo.me";
set :encodeurl "body_param" "⚠ Un mail identifié comme spam est arrivé
De : ${sender}
Objet : ${subject}
A ouvrir avec une grande attention.";
notify :from "noreply@foo.me" :importance "1" :message "⛔ [SPAM] Un mail identifié comme spam est arrivé" "mailto:${vmailto}?body=${body_param}";
stop;
}
}
}
require ["editheader", "variables", "copy", "fileinto", "imap4flags", "enotify"];
if allof (address :matches "From" "mynas01@foo.me", header :contains "Subject" "succès")
{
setflag "\\Seen";
fileinto "MYNAS";
stop;
}
##filter for foo.ME
require ["editheader", "variables", "copy", "fileinto", "imap4flags", "enotify"];
#if listed, discard
if anyof (address :matches "To" "audi-connecttion@foo.me", address :matches "To" "lastfm@foo.me")
{
set "vto" "${1}";
discard;
set "vmailto" "stephane.dxxxxxx@foo.me";
set :encodeurl "body_param" "⚠️ Un mail supprimé suivant vos règles
A : ${vto}
Le mail a été automatiquement supprimé.";
notify :from "noreply@foo.me" :importance "1" :message "⚠ [discard] Un mail supprimé suivant vos règles" "mailto:${vmailto}?body=${body_param}";
stop;
}
#if spam, add icon, move to spam folder and send a notification
if allof (header :matches "x-infomaniak-spam" "spam", not address :matches "from" "noreply@foo.me")
{
if header :matches "Subject" "*"
{
set "subject" "${1}";
if header :matches "from" "*"
{
set "sender" "${1}";
deleteheader "Subject";
addheader :last "Subject" "⛔ ${subject}";
fileinto "Spam";
set "vmailto" "stephane.dxxxxxx@foo.me";
set :encodeurl "body_param" "⚠ Un mail identifié comme spam est arrivé
De : ${sender}
Objet : ${subject}
A ouvrir avec une grande attention.";
notify :from "noreply@foo.me" :importance "1" :message "⛔ [SPAM] Un mail identifié comme spam est arrivé" "mailto:${vmailto}?body=${body_param}";
stop;
}
}
}
#conditionnal action (mail, subject...)
A la réception d'un mail d'un destinataire et contenant un mot dans l'objet, marquage comme lu et déplacement.
if allof (address :matches "From" "mynas01@foo.me", header :contains "Subject" "succès")
{
setflag "\\Seen";
fileinto "MYNAS";
stop;
}
if header :matches "Subject" "*"
{
set "subject" "${1}";
if address :contains "To" "stephane.dxxxxxx@gmail.com"
{
deleteheader "Subject";
addheader :last "Subject" "✉️ [Gmail] ${subject}";
}
elsif anyof (address :is :domain "to" "foo.fr.eu.org", address :is :domain "to" "foo.me.eu.org")
{
deleteheader "Subject";
addheader :last "Subject" "✉️ [eu.org] ${subject}";
}
elsif address :matches "To" "sd@foo.me"
{
deleteheader "Subject";
addheader :last "Subject" "🌈 ${subject}";
}
keep;
stop;
}
#end