Use sieve to move all mail automatically based on List-Id
Dear all,
I currently use the following rule to automatically sort email into folders based on mailing lists:
# split out the various list forms # Mailman & other lists using list-id if exists "list-id" { if header :regex "list-id" "<([a-z_0-9-]+)[.@]" { set :lower "listname" "${1}"; fileinto :create "${listname}"; } else { if header :regex "list-id" "^\\s*([a-z_0-9-]+)[.@]" { set :lower "listname" "${1}"; fileinto :create "${listname}"; } else { keep; } } stop; }
This works really nice. The only problem I have here is that it does use the ID, but not the name and this can lead to strange folder names. If an email has e.g. the following header:
List-Id: mfechner/ci-test <142.ci-test.mfechner.gitlab.fechner.net>
it moves the email to the folder 142 as the regex matches inside the <> string till the none-letter/none-number/_/- is matching. I do not understand the expresion [.@] so it is nearly impossible for my to extend that query.
What I would like to do is using the ID as folder name as fallback.
So in this case I would like that the email is moved to folder mfechner/ci-test
.
I'm not sure if sieve can handle the /
correctly.
Thanks a lot for any tip.
Gruß Matthias
--
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to produce bigger and better idiots. So far, the universe is winning." -- Rich Cook
participants (1)
-
Matthias Fechner