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" 
“.*@(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:
.*@(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 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/
 


On Thursday, 27. March 2025 14:13 CET, "Christian Mack" 
([email protected]) <[email protected]> wrote:

 
Hello

Disclaimer: I don't know mailcow.

Am 25.03.25 um 22:48 schrieb "Alexander Skwar" ([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 <[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] <[email protected]> *On Behalf Of *"Alexander
> Skwar"
> *Sent:* mardi 25 mars 2025 16:27
> *To:* [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, .*@(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|
> 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, hiking-buddies@dom1\.rodeo|
> carving\.fleshed313@dom2\.vip|com\+wandrer\[email protected]|
> squadrats\.com@dom1\.rodeo <mailto:hiking-buddies@dom1\.rodeo|
> carving\.fleshed313@dom2\.vip|com\+wandrer\[email protected]|
> squadrats\.com@dom1\.rodeo>
> o From, contains, [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; [email protected]
> <mailto:[email protected]>;
> From: Munzee Gardening Club <[email protected] <mailto:[email protected]>>
> Reply-To: =?utf-8?Q?Munzee=20Gardening=20Club?= <[email protected]
> <mailto:[email protected]>>
> FORGED_SENDER(0.30)[[email protected],bounce-mc.us10_38846137.13528275-
> [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-
> [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 “.*@freezetag.com$
> <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, .*@(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 <[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
> “[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/>
> 


-- 
Christian Mack
Universität Konstanz
Kommunikations-, Informations-, Medienzentrum (KIM)
Abteilung IT-Dienste Forschung, Lehre, Infrastruktur
78457 Konstanz
+49 7531 88-4416
 

Reply via email to