• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

Forwarded to devs deletion of spam folder mails after 30 days not working

TomBoB

Regular Pleskian
Username:

TITLE

deletion of spam folder mails after 30 days not working

PRODUCT, VERSION, OPERATING SYSTEM, ARCHITECTURE

18.0.39 Update #2, CentOS 7.9

PROBLEM DESCRIPTION

Mails in the clients spam mail folder are not deleted after 30 days (as configured) but appear to stay indefinitely.

STEPS TO REPRODUCE

Have a spam folder as part of a normal mailbox. Wait until it fills up. Wait for more then 30 days.

ACTUAL RESULT

Mails older then 30 days are not deleted.

EXPECTED RESULT

Mails older then 30 days are deleted.

ANY ADDITIONAL INFORMATION

Tested it (checked client accounts [with permission]) on multiple servers, multiple subscriptions. Some subscriptions been on the same server from the beginning, others were migrated from other servers.

This happens on servers with PES loaded, but also on servers with no PES and MagicSpam instead.
---
may play a role: we have the servers configured to use the special use folder setup as per this article: https://support.plesk.com/hc/en-us/...t-mail-clients-and-automatically-create-them-

unfortunately I cannot remove that anywhere at the moment to narrow it down further.
---
have tested it via webmail on dozens of addresses across about 15 subscriptions/domains (we do 1 per) on multiple servers.

YOUR EXPECTATIONS FROM PLESK SERVICE TEAM

Confirm bug
 
Errors from spamtrain should be reported to panel.log. For further investigation the following information is needed:
  1. Is SpamAssassin installed (is /usr/bin/sa-learn executable)?
  2. Is spam filtering enabled for the e-mail address in question?
  3. What errors are present in panel.log?
Thanks.
 
1. on the servers that use PES, yes as part of PES. On the server that uses magicspam, yes it is also installed as part of the normal Plesk installation.
It is executable.
# /usr/bin/sa-learn --version
SpamAssassin version 3.4.0

2. yes spam filtering is enabled for all those mailboxes where i checked. And is set to "move into spam", not set to "mark as spam". It detects spam perfectly as per settings and put them into the spam folder. They just don't get deleted after 30 days (as per instruction)

3. have not been able to find any hint in the log file.

I don't think the problem is spamassassin as the detection works fine. The problem seems to lie with whatever script in plesk triggers the deletion, something not done by spamassassin itself.
 
Thank you,

Please, run the command

# plesk daily ExecuteSpamtrain

in terminal and check if old spam messages have been deleted then. If not, check panel.log for errors.
 
# plesk daily ExecuteSpamtrain
ran for about 5 minutes.
Emails older then 30 days are still in the spam folder. No entry at all in the panel.log.

Ran it also on another server. Took a minute, Emails older than 30 days still in spam folder. No entry at all in panel.log
 
removed the special use folder configuration and retested, same result. Old emails in Spam stay, no entry in panel.log
 
Hi @IgorG

we need to reopen this bug please. You seem to have a regression.
Am looking at spam folders of mailboxes of subscriptions on different servers. All use PES, all have deletion after 30 days enabled. One spam folder has junk in it going back to 24 Nov 2021, another one has junk going back to 20 Jan 2022, another one again going back to 07 Dec 2021.

ran above tests again and checked the panel.log - nothing.
 
I don't use PES myself, so this might be the wrong tip for you, but have you checked this file?

/usr/local/psa/admin/sbin/spamtrain

It contains a hardcoded value for the number of days:

# remove messages from .Spam folder after period(in days)
delete_interval="30"
 
sorry for the late reply. Yes, the deletion interval is set to 30 days. Even if i run

# plesk daily ExecuteSpamtrain

manually, it does not delete mails in the spam folder that are older then 30 days. I'm looking at a mailbox right now that has mails in the spam folder going back to 06 October 2021. Which indicates that the fix published on 11 Jan 2022 (see here) for above bug EXTCERT-3652 isn't working properly.
 
Bug EXTCERT-3652 seems to be still in regression. Done all above. Mails in spam folder are not being deleted. Looking at a clients spam folder having mails going back to 13 November 2021.
 
Changelog says the auto-cleanup of spam mails after 30 days is done. Bug EXTCERT-3652

It is not. Am looking at a spam folder with mails going back to 26 April 2022.
 
As a workaround you could use the script below and create a cronjob dat runs it daily.

Bash:
#!/bin/bash

for i in $(/usr/local/psa/bin/mail -l | sed '/^Alias/d' | tr '\t' ' ' | cut -d' ' -f 3-); do
    doveadm expunge -u "$i" mailbox INBOX.Spam before 30d
done
 
Last edited:
Thanks Kaspar,

at the same time I'll keep bugging Plesk to eventually provide a fix for the issue. They offer it as an option, so it should be working. ;)

Today looking at a spam folder with 6786 mails in it, going back to 22 July 2022.
 
Back
Top