Bug - Incoming spam emails is not sorted into junk folder
- 
					
					
					
					
 @AnotherAndy Am sorry if I was not clear enough. My bad. As you can see in my first post, “X-Spam-Status” does not exist in the incoming email but “X-Spam” does. 
- 
					
					
					
					
 Dec 04 12:26:23 kopano kopano-dagent[4696]: Mail will be delivered in Inbox Unless you define some rules, or have some other magical extra component that does it for you, it won’t be moved to Junk. 
- 
					
					
					
					
 @jengelh Hello there. Thanks for replying. 
 In the config file /etc/kopano/dagent.cfg it says# The following e-mail header will mark the mail as spam, so the mail # is placed in the Junk Mail folder, and not the Inbox. # The name is case insensitive. # set to empty to not use this detection scheme. spam_header_name = X-SpamI read it as the incoming email will be placed in the Junk Mail folder, and not the inbox. Is that not correct? 
- 
					
					
					
					
 Hi @Blinkiz , 
 that’s what I tried to say, use
 “spam_header_name = X-Spam-Status” - without “” in your dagent.cfg
 We had a similar topic here:
 https://forum.kopano.io/topic/125/spam-is-not-sorted-into-junk-folder/4
- 
					
					
					
					
 @AnotherAndy 
 Okay, I changed back to spam_header_name = X-Spam-Status and it still does not work. Again, I do not have a X-Spam-Status header in my incoming emails. I have X-Spam instead.
- 
					
					
					
					
 I’m sorry I thought you were also using spamassassin. 
 maybe @jengelh can tell the magic tricks to do
- 
					
					
					
					
 I found why it does not work for me. Look at the incoming message I wrote in my first post. root@kopano:[~]: grep -i 'spam' /tmp/raw_messages/LMTP_20181204122623_641be4e6.eml X-Rspamd-Queue-Id: D428A44FF9 X-Spamd-Result: default: False [11.15 / 15.00]; X-Rspamd-Server: smtp X-Spam: YesI then specify to look for X-Spam in my configuration. root@kopano:[~]: cat /etc/kopano/dagent.cfg | egrep -v "(^#.*|^$)" log_level = 5 log_raw_message = yes log_raw_message_path = /tmp/raw_messages spam_header_name = X-Spam spam_header_value = YesLooking at the source code at https://github.com/Kopano-dev/kopano-core/blob/master/spooler/DAgent.cpp i can see that only the first match is returned. In my Message I first have “X-Spamd-Result” which will be the one Kopano is checking against and not “X-Spam” header. This is a bug in the Kopano code. 
- 
					
					
					
					
 Hi @Blinkiz , thanks for your report. I have created https://jira.kopano.io/browse/KC-1392 to follow this up. 
- 
					
					
					
					
 I am suffering from the same bug because still running kopano 8.5.9.0 and an update is being planned. But my question is: can I patch my dagent quickly as shown here? what do I need to do to patch my existing kopano-dagent with this bugfix? In my understanding it would me need to modify just the line 2114 in dagent.cpp and somehow compile/update it so I can get a patched kopano-dagent binary. Can anyone show me the correct command and steps therefore? I tried to search for a “dagent.cpp” but no hits on my filesystem. any help appreciated 
- 
					
					
					
					
  
 The patch (2cc082) is only in 8.7 and later which, incidentally, made its debut 365 days ago.
- 
					
					
					
					
 hehe, nice pic :) does that mean I cannot just change this particular line to get/compile a new kopano-dagent ? are there other/many stuff affected for that patch being able to be effective? 
- 
					
					
					
					
 @micro You are running a version that was released more than 1.5 years ago. I can’t tell if ‘just patching’ will lead to trouble - I would recommend that you upgrade to the latest version instead and benefit from all the other improvements and fixes. 
- 
					
					
					
					
 definitely you’re right. Nevertheless I am curious if this could be a “faster” workaround. It does not mean I will not upgrade, but the upgrade is more time intensive and currently time is very limited along other projects (higher importance). That was just a thought if I could workaround by this. however, thanks for your reply. 
- 
					
					
					
					
 @micro Hello. 
 To fix his problem without upgrading, change incoming spam header into “X-Spam-Status” or something else that can not match multiple times in your email header. In my case I configure this in rspamd.
- 
					
					
					
					
 that’s exactly what I intented to do when this solution mentioned here not possible. Did you configure this in local.d/worker-proxy.inc ? 
- 
					
					
					
					
 @micro said in Bug - Incoming spam emails is not sorted into junk folder: that’s exactly what I intented to do when this solution mentioned here not possible. Did you configure this in local.d/worker-proxy.inc ? I do not remember, sorry. Am running latest version of Kopano now days. 
- 
					
					
					
					
 ok, solved. Works like a charm now … 
 
			
		