Page 1 of 1

Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 10:08
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)

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 10:22
by Florian
Hallo,

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

Maybe you have renamed the folder?

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 10:30
by Alexander
Hello,

which mail client are you using for connecting to your mailbox?

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 11:26
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)

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 12:02
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

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

Posted: Fri 13. May 2022, 12:08
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
  }
}

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 12:39
by amarc
Thanks. I will update it manually until 22.1. Basically you added auto = subscribe ?

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 12:53
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

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 13:14
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.

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 13:28
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.

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 13:54
by amarc
Great, thanks 👍

I tested it and can confirm all works as expected.. Only .Junk folder is present

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 14:56
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

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 15:35
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.

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 16:20
by ShortSnow
Hm,

blind test(er) :oops: , Sorry!

Re: Crontab for learning Spam seems to be Wrong

Posted: Fri 13. May 2022, 18:48
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.