Crontab for learning Spam seems to be Wrong  [SOLVED]

Have you discovered a bug? Tell us about it.
Post Reply
amarc
Posts: 34
Joined: Thu 7. May 2020, 18:56

Crontab for learning Spam seems to be Wrong

Post by amarc »

Hello,

in /etc/cron.d/keyhelp-sa-learn you have:

Code: Select all

30 0 * * * root nice /usr/bin/sa-learn --dbpath /var/spool/spamassassin --spam /var/mail/vhosts/*/*/.Junk > /dev/null
which does nothing as Spam/Junk folder on mailboxes is called

Code: Select all

.Junk E-mail
I could not find where do you declare this "special folder" in dovecot so I fixed crontab with

Code: Select all

30 0 * * * root nice /usr/bin/sa-learn --dbpath /var/spool/spamassassin --spam /var/mail/vhosts/*/*/.Junk\ E-mail > /dev/null
So IMO, there should either be fix on how is "Junk" folder named or above crontab script should be fixed as per above.


A.
------------------------------------------------------------------------


I'm sure the cause of the problem is within KeyHelp



Debian 11



KVM



22.0 (Build 2393)
User avatar
Florian
Keyweb AG
Posts: 1243
Joined: Wed 20. Jan 2016, 02:28

Re: Crontab for learning Spam seems to be Wrong

Post by Florian »

Hallo,

the default folder is named Junk so the cronjob is correct.

Maybe you have renamed the folder?
Mit freundlichen Grüßen / Best regards
Florian Cheno

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Crontab for learning Spam seems to be Wrong

Post by Alexander »

Hello,

which mail client are you using for connecting to your mailbox?
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
amarc
Posts: 34
Joined: Thu 7. May 2020, 18:56

Re: Crontab for learning Spam seems to be Wrong

Post by amarc »

Florian wrote: Fri 13. May 2022, 10:22 Hallo,

the default folder is named Junk so the cronjob is correct.

Maybe you have renamed the folder?
No I did not. I tested this by creating brand new account and waiting for it to be created on filesystem. Than simple

Code: Select all

ls
on that new account would show

Code: Select all

.Junk E-mail


So to answer Alexander too.. I did not even connect to email at all as this was tested and discovered on brand new accounts

Edit: it does seem like folder is not created until first login. So to answer that question. Rainloop via IMAP but outside Keyhelp (on external domain)
amarc
Posts: 34
Joined: Thu 7. May 2020, 18:56

Re: Crontab for learning Spam seems to be Wrong

Post by amarc »

Additionally, dovecot/conf.d/15-mailboxes.conf should contain

Code: Select all

mailbox Spam {
    special_use = \Junk
    auto = subscribe
  }
under

Code: Select all

namespace inbox {
As a lot of mail clients are naming Junk as Spam. I tried to add above in /etc/dovecot/local.conf but nothing really hapens
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Crontab for learning Spam seems to be Wrong  [SOLVED]

Post by Alexander »

Yes, unfortunately Rainloop does not stick to the recommended names (by RFC) if they are not supplied.

I've now put the following in /etc/dovecot/conf.keyhelp.d/15-mailboxes.conf
And it worked (when creating a new mail account and log in the first time with Rainloop).
Take it with a grain of salt, is this was just a quick test. I will implement it within the next KeyHelp Update 22.1, but the content of the file below very likely change a bit.

Code: Select all

namespace inbox {
  inbox = yes

  # These mailboxes are widely used and could perhaps be created automatically:
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  
  # For \Sent mailboxes there are two widely used names. We'll mark both of
  # them as \Sent. User typically deletes one of them if duplicates are created.
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = subscribe
    special_use = \Sent
  }
}
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
amarc
Posts: 34
Joined: Thu 7. May 2020, 18:56

Re: Crontab for learning Spam seems to be Wrong

Post by amarc »

Thanks. I will update it manually until 22.1. Basically you added auto = subscribe ?
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Crontab for learning Spam seems to be Wrong

Post by Alexander »

Files within /etc/dovecot/conf.d are not included, only files in /etc/dovecot/conf.keyhelp.d/ are taken into account.
However, changes in the local.conf should work too. I have not testet it with the local.conf. Instead i put it right into the /etc/dovecot/conf.keyhelp.d/15-mailboxes.conf.

I have start testing with auto = create. But will change it to auto = subscribe with KeyHelp 22.1
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
amarc
Posts: 34
Joined: Thu 7. May 2020, 18:56

Re: Crontab for learning Spam seems to be Wrong

Post by amarc »

But at least on my installation /etc/dovecot/conf.keyhelp.d/ does not contain 15-mailboxes.conf at all . I only have: 10-auth.conf 10-services.conf 10-ssl.conf 20-protocols.conf 90-plugins.conf there.
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Crontab for learning Spam seems to be Wrong

Post by Alexander »

Yes, this file will part of the upcoming update. Currently it does not exist.

You can already put the file there, it will simply be overwritten with the next update.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
amarc
Posts: 34
Joined: Thu 7. May 2020, 18:56

Re: Crontab for learning Spam seems to be Wrong

Post by amarc »

Great, thanks 👍

I tested it and can confirm all works as expected.. Only .Junk folder is present
User avatar
ShortSnow
Posts: 251
Joined: Thu 15. Nov 2018, 00:45

Re: Crontab for learning Spam seems to be Wrong

Post by ShortSnow »

Hi,

testet the new config file. Ist much better then before. It corrects also "Send" and "Trash". So far I've adjusted it by hand.

A small blemish:

Image

There is now an unused folder: Sent Messages

THX Arne
User avatar
Alexander
Keyweb AG
Posts: 3810
Joined: Wed 20. Jan 2016, 02:23

Re: Crontab for learning Spam seems to be Wrong

Post by Alexander »

Thank you for testing ;)
ShortSnow wrote: Fri 13. May 2022, 14:56 There is now an unused folder: Sent Messages
This is because of this part of the above config:

Code: Select all

  # For \Sent mailboxes there are two widely used names. We'll mark both of
  # them as \Sent. User typically deletes one of them if duplicates are created.
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = subscribe
    special_use = \Sent
  }

and the reason why I am said, the content of the file may change until release ;).
Currently I am unsure if I should keep the "Sent Messages" folder, or if it is just a relic of the past.
I have a feeling I've encountered Apple Mail utilize this folder - but currently I don't have an Apple device here at work to test it with. Will investigate next week.
Mit freundlichen Grüßen / Best regards
Alexander Mahr

**************************************************************
Keyweb AG - Die Hosting Marke
Neuwerkstr. 45/46, 99084 Erfurt / Germany
http://www.keyweb.de - http://www.keyhelp.de
**************************************************************
User avatar
ShortSnow
Posts: 251
Joined: Thu 15. Nov 2018, 00:45

Re: Crontab for learning Spam seems to be Wrong

Post by ShortSnow »

Hm,

blind test(er) :oops: , Sorry!
User avatar
ShortSnow
Posts: 251
Joined: Thu 15. Nov 2018, 00:45

Re: Crontab for learning Spam seems to be Wrong

Post by ShortSnow »

Hi,

Folder "Sent Messages" can't deleted in Rainloop. It is automaticly recreated and the it is also created in every Mailbox (only tested Rainloop), not only new Mailboxes.
Post Reply