Hello, The sieve script seems to be correctly written so you should either check with dovecot/pigeonhole or mailcow.
Btw, the rfc that specified the double \ -> https://www.ietf.org/archive/id/draft-ietf-sieve-regex-01.html section 6 <https://www.ietf.org/archive/id/draft-ietf-sieve-regex-01.html%20section%206> . \\ Escape the following special character (match the literal character). Undefined for other characters. NOTE: Unlike <https://www.ietf.org/archive/id/draft-ietf-sieve-regex-01.html#IEEE.1003-2.1992> [IEEE.1003‑2.1992], a double-backslash is required as per section 2.4.2 of <https://www.ietf.org/archive/id/draft-ietf-sieve-regex-01.html#RFC5228> [RFC5228]. You can set up sieve log -> https://doc.dovecot.org/2.3/settings/pigeonhole/#pigeonhole_setting-sieve_user_log Quentin From: [email protected] <[email protected]> On Behalf Of "Alexander Skwar" Sent: lundi 31 mars 2025 06:58 To: [email protected] Subject: [SOGo] Filtering fails with subfolders containing emoijis 🗣 (was: RE: Regexp filter does not match) Hi Yes, the sieve server understands and can cope with emojis. Certain non-emoji chars, like “&” (ampersand) cause issues on the IMAP side. Due to this, SOGo (or whatever…) fails to create a folder named “MLs & Foren”. I've renamed this to “MLs + Foren” now, which is good enough for me. Emojis per se are not causing issues. The folder is actually not simply called “MLs + Foren” but rather “🗣 MLs + Foren”. Mails from this mailinglist ([email protected] <mailto:[email protected]> ) get filed properly, thanks to this filter: require ["fileinto","imap4flags","regex"]; if anyof (header :contains "List-Id" "users.sogo.nu") { fileinto "🗣 MLs + Foren"; } BUT… I've now created a new folder simply named “Draussen” (the “original” folder is named “🏔🚴 Draussen”) as a subfolder of “Social Networks”. The rule looks like this: require ["fileinto","imap4flags","regex"]; if anyof (address :regex :comparator "i;octet" "from" ".*@(bergportal\\.ch|freezetag\\.com|garmin\\.com|geocaching\\.com|komoot\\.de|munzee\\.com|quaeldich\\.de|spontacts\\.com|squadrats\\.com|strava\\.com|update\\.strava\\.com|velocity\\.ch|wandrer\\.earth)$", address :regex :comparator "i;octet" ["to", "cc"] "hiking-buddies@acc\\.alexs77\\.rodeo|carving\\.fleshed313@alexs77\\.foobar\\.vip|com\\+wandrer\\.earth@skwar\\.me|squadrats\\.com@acc\\.alexs77\\.rodeo", address :contains "from" "[email protected] <mailto:[email protected]> ") { fileinto "Social Networks/Draussen"; } I've got one email from <https://mail.5y5.one/SOGo/so/[email protected]/Mail/view> [email protected] and that got properly filed away. Are there logs somewhere? Is it maybe the fact, that it is a subfolder? That's getting annoying, got to say… ………… Let it run over the weekend, and, yes, something's not working with subfolders. I created “🏔🚴 Draussen” as a “main folder” and filtering with this rule worked fine: if anyof (address :regex :comparator "i;octet" "from" ".*@(bergportal\\.ch|freezetag\\.com|garmin\\.com|geocaching\\.com|komoot\\.de|munzee\\.com|quaeldich\\.de|spontacts\\.com|squadrats\\.com|strava\\.com|update\\.strava\\.com|velocity\\.ch|wandrer\\.earth)$") { fileinto "🏔🚴 Draussen"; } I wonder — which part on the server side is so very fragile? The matching works, so, that's not it. Is it sieve? Is it the storage? Which part breaks due to emojis? As asked before — are there logs? If so, where? Stopping to use emojis is not a solution. Not using subfolders is also not a solution. Cheers, Alexander -- Complete contact details at https://a.skwar.xyz/ On Friday, 28. March 2025 11:08 CET, "qhivert" ([email protected] <mailto:[email protected]> ) <[email protected] <mailto:[email protected]> > wrote: Hello, With my test where it works, I have: require ["regex","fileinto"]; if anyof (address :regex :comparator "i;octet" "from" <mailto:.*@(bergportal\\.ch|example\\.org|garmin\\.com|geocaching\\.com|komoot\\.de|munzee\\.com|quaeldich\\.de|spontacts\\.com|squadrats\\.com|strava\\.com|update\\.strava\\.com|velocity\\.ch|wandrer\\.earth)$> .*@(bergportal\\.ch|example\\.org|garmin\\.com|geocaching\\.com|komoot\\.de|munzee\\.com|quaeldich\\.de|spontacts\\.com|squadrats\\.com|strava\\.com|update\\.strava\\.com|velocity\\.ch|wandrer\\.earth)$) { fileinto "Trash"; } Notice I just change freezetag\.com to example\.org in my filter. The double dash is not an error and expected. But I’m wondering if your sieve server can understand emojis. Could you try with a folder that only has characters? You said it works with this: * From, matches re, <mailto:.*@(company\.com|name1\.me|name2\.one)$> .*@(company\.com|name1\.me|name2\.one)$ Could you do this one again and compare the sieve script? Quentin From: [email protected] <mailto:[email protected]> <[email protected] <mailto:[email protected]> > On Behalf Of "Alexander Skwar" Sent: jeudi 27 mars 2025 17:49 To: [email protected] <mailto:[email protected]> Subject: [SOGo] [SPAM] Re: [SPAM] RE: [SPAM] Regexp filter does not match Hello Did my message from yesterday at about 21:00 not make it through? Really curious, because somehow the message coming back always have the “[SPAM]” “flag” in the subject… Here it was: -------- Okay, I finally found the sieve file. And the filters, they are broken. No wonder it's not working. >From the file: if anyof (address :regex :comparator "i;octet" "from" “ <mailto:.*@(bergportal\\.ch|freezetag\\.com|garmin\\.com|geocaching\\.com|komoot\\.de|munzee\\.com|quaeldich\\.de|spontacts\\.com|squadrats\\.com|strava\\.com|update\\.strava\\.com|velocity\\.ch|wandrer\\.earth)$> .*@(bergportal\\.ch|freezetag\\.com|garmin\\.com|geocaching\\.com|komoot\\.de|munzee\\.com|quaeldich\\.de|spontacts\\.com|squadrats\\.com|strava\\.com|update\\.strava\\.com|velocity\\.ch|wandrer\\.earth)$”) { fileinto "Social Networks/🏔🚴 Draussen"; } That's verbatim how it looks like and that's of course wrong. Why in the world would it escape the “\”? It must be left alone. In the UI, I entered: <mailto:.*@(bergportal\.ch|freezetag\.com|garmin\.com|geocaching\.com|komoot\.de|munzee\.com|quaeldich\.de|spontacts\.com|squadrats\.com|strava\.com|update\.strava\.com|velocity\.ch|wandrer\.earth)$> .*@(bergportal\.ch|freezetag\.com|garmin\.com|geocaching\.com|komoot\.de|munzee\.com|quaeldich\.de|spontacts\.com|squadrats\.com|strava\.com|update\.strava\.com|velocity\.ch|wandrer\.earth)$ For the last entry, it means: “wandrer” followed by EXACTLY the char “.” followed by “earth”. Now, with whatever SOGo did, it came out as: wandrer\\.earth That's “wandrer” followed by “\.” (backslash dot) followed by “earth”. That's broken. No wonder it's not working. I'm using mailcow <https://mail.5y5.one/admin/dashboard> 2025-03 and SOGo that comes with it (v5.11.2). Now, I could of course write in the filter condition: …|wandrer.earth)$ That WOULD be left alone, but that's wrong. It would mean “wandrer” followed by any char followed by “earth”. ---------- -- Alexander -- Complete contact details at <https://a.skwar.xyz/> https://a.skwar.xyz/ On Thursday, 27. March 2025 14:13 CET, "Christian Mack" ( <mailto:[email protected]> [email protected]) < <mailto:[email protected]> [email protected]> wrote: Hello Disclaimer: I don't know mailcow. Am 25.03.25 um 22:48 schrieb "Alexander Skwar" ( <mailto:[email protected]> [email protected]): > Hi > > Thanks a lot for confirming that it should work. > > Can you please tell me how I would get the created filter? > You can get the generated sieve rules from your postbox server via managesieve, or if you use dovecot from the users sieve folder. > And while we're at it — is there a way to create more filters at once, without > having to use the UI? As mentioned, I'm migrating from Gmail and would "need" > to > create a bunch of filters. Not having to resort to the UI would be useful. > As an admin you can use sogo-tool for changing sieve rules from the command line of the SOGo server. You can get the current sieve rules with: # /usr/sbin/sogo-tool user-preferences get defaults ${USER_WITH_SIEVE_FILTERS} SOGoSieveFilters You can set new/changed sieve rules with: # /usr/sbin/sogo-tool user-preferences set defaults ${USER_WITH_SIEVE_FILTERS} -p /etc/sogo/sieve.creds SOGoSieveFilters '{"SOGoSieveFilters":[{"actions":[{"argument": "Spam-Folder","method": "fileinto"},{"argument": "<null>","method": "stop"}],"name": "Filter-SPAM-into-other-folder","rules": [{"field": "header","operator": "is","custom_header": "X-Spam","value": "YES"}],"match": "any","active": 1}]}' Beware, you have always to provide all Filters in that Json, as only the ones provided will be set. Kind regards, Christian Mack > Am 25.03.2025 17:01 schrieb qhivert < <mailto:[email protected]> [email protected]>: > > Hello, > > I’ve just tested your first filter with all the conditions and this work well. > > To be sure, can you get the sieve script generated by sogo? And see if what’s > in > there match your filter. > > Quentin > > *From:*[email protected] < <mailto:[email protected]> > [email protected]> *On Behalf Of *"Alexander > Skwar" > *Sent:* mardi 25 mars 2025 16:27 > *To:* <mailto:[email protected]> [email protected] > *Subject:* [SOGo] [SPAM] Regexp filter does not match > > Hello > > Currently trying to move from Gmail to maicow + SOGo. One of the issues I > encounter is the filtering in mailcow/SOGo. > > I've got the following filter: > > * Match any of the following rules > o From, matches regex, > <mailto:.*@(bergportal\.ch|freezetag\.com|garmin\.com|> > .*@(bergportal\.ch|freezetag\.com|garmin\.com| > geocaching\.com|komoot\.de|munzee\.com|quaeldich\.de|spontacts\.com| > squadrats\.com|strava\.com|update\.strava\.com|velocity\.ch| > wandrer\.earth)$ < <mailto:.*@(bergportal\.ch|freezetag\.com|garmin\.com|%0b> > mailto:.*@(bergportal\.ch|freezetag\.com|garmin\.com| > geocaching\.com|komoot\.de|munzee\.com|quaeldich\.de|spontacts\.com| > squadrats\.com|strava\.com|update\.strava\.com|velocity\.ch| > wandrer\.earth)$> > o To or Cc, matches regex, <mailto:hiking-buddies@dom1\.rodeo|> > hiking-buddies@dom1\.rodeo| > carving\.fleshed313@dom2\.vip|com\+wandrer\[email protected]| > squadrats\.com@dom1\.rodeo < <mailto:hiking-buddies@dom1\.rodeo|%0b> > mailto:hiking-buddies@dom1\.rodeo| > carving\.fleshed313@dom2\.vip|com\+wandrer\[email protected]| > squadrats\.com@dom1\.rodeo> > o From, contains, <mailto:[email protected]> > [email protected] > < <mailto:[email protected]> mailto:[email protected]> > * Actions > o File the message in, 🏔🚴Draussen > > However, it does not work. But why? Are there logs somewhere? > > It should match - I'm looking for “From” “matches” "…freezetag\.com > > $ grep -i freezetag\.com ~/tmp/message-headers-freezetag.txt > dkim=pass header.d=freezetag.com header.s=k3 header.b=PLkik2a8; > dmarc=pass (policy=none) header.from=freezetag.com > dkim=pass header.d=freezetag.com header.s=k3 header.b=PLkik2a8; > dmarc=pass (policy=none) header.from=freezetag.com > DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freezetag.com; s=k3; > t=1742915017; x=1743185017; <mailto:[email protected]> > [email protected] > < <mailto:[email protected]> mailto:[email protected]>; > From: Munzee Gardening Club < > <mailto:[email protected]%20%3cmailto:[email protected]> > [email protected] <mailto:[email protected]>> > Reply-To: =?utf-8?Q?Munzee=20Gardening=20Club?= < > <mailto:[email protected]%0b> [email protected] > < <mailto:[email protected]> mailto:[email protected]>> > FORGED_SENDER(0.30)[[email protected],bounce-mc.us10_38846137.13528275- > <mailto:[email protected]> > [email protected]]; > R_DKIM_ALLOW(0.00)[freezetag.com:s=k3]; > DMARC_POLICY_ALLOW(0.00)[freezetag.com,none]; > FROM_NEQ_ENVFROM(0.00)[[email protected],bounce- > <mailto:[email protected]> > [email protected]]; > HAS_REPLYTO(0.00)[[email protected]]; > DKIM_TRACE(0.00)[freezetag.com:+]; > > I'll attach the complete headers. > > Any ideas about why it does not work? How can I test this? > > I would have thought it might be, because I'm doing “ > <mailto:.*@freezetag.com$%0b%3e%20%3cmailto:.*@freezetag.com$%3e> > .*@freezetag.com$ <mailto:.*@freezetag.com$%0b%3e%20%3cmailto:.*@freezetag.com$%3e> > <mailto:.*@freezetag.com$>”, ie. freezetag.com must be at the end of the line. > But in the “From:” line, there's the “>” after “freezetag.com”. > > BUT… I've got a different filter with this rule: > > * From, matches re, <mailto:.*@(company\.com|name1\.me|name2\.one)$> > .*@(company\.com|name1\.me|name2\.one)$ > < <mailto:.*@(company\.com|name1\.me|name2\.one)$> > mailto:.*@(company\.com|name1\.me|name2\.one)$> > > And this DOES work. It matched an email with this from line in the headers: > > From: Alexander Skwar < <mailto:[email protected]%20%3cmailto:[email protected]> > [email protected] <mailto:[email protected]>> > > There was also a “>” at the end (which there will almost always be; at least > if there's a “real name” and if it's not using the outdated syntax of > “ <mailto:[email protected]%20%[email protected]%3e%20(real%20name)> > [email protected] <[email protected]> (real name)”). > > Help would be immensely appreciated for getting filters with regexps to work. > > Thanks a lot, > > Alexander > > -- > Complete contact details at <https://a.skwar.xyz/> https://a.skwar.xyz/ < > <https://a.skwar.xyz/> https://a.skwar.xyz/> > -- Christian Mack Universität Konstanz Kommunikations-, Informations-, Medienzentrum (KIM) Abteilung IT-Dienste Forschung, Lehre, Infrastruktur 78457 Konstanz +49 7531 88-4416
