• The APS Catalog has been deprecated and removed from all Plesk Obsidian versions.
    Applications already installed from the APS Catalog will continue working. However, Plesk will no longer provide support for APS applications.
  • Please be aware: with the Plesk Obsidian 18.0.78 release, the support for the ngx_pagespeed.so module will be deprecated and removed from the sw-nginx package.

Question Webmail Spam Folder Enable via CLI

AK_learner

Basic Pleskian
Server operating system version
Almalinux 8.10
Plesk version and microupdate number
Plesk Obsidian 18.0.77 #4
Hi Pleskians @IgorG @Sebahat.hadzhi @Kaspar

When SpamAssassin settings are configured to move into the SPAM folder, it moved the mails to that folder in the Mailbox.

However, the folder needs to be manually updated in the Webmail for it to be visible.

How can I enable the SPAM folder for 1000+ mailboxes via CLI (as doing so manually will be very troublesome and customer's won't share the logins).

Any ideas? Looking forward to suggestions/options.
 
Ignore,

I have found the solution!

For a Single User:

Code:
doveadm mailbox subscribe -u "$user" INBOX.Spam

For all users:

  1. Fetch the Mailboxes:

    Code:
    plesk db -Ne " SELECT CONCAT(mail_name,'@',domains.name) FROM mail JOIN domains ON domains.id=mail.dom_id WHERE postbox='true'; " > /tmp/mailboxes.txt

  2. Apply to the Mailboxes:
    Code:
    while read user; do    echo "$(date) Processing $user" | tee -a /var/log/spam-folder-fix.log
    
        doveadm mailbox create -u "$user" INBOX.Spam >/dev/null 2>&1
        doveadm mailbox subscribe -u "$user" INBOX.Spam >/dev/null 2>&1
    
        if [ $? -eq 0 ]; then
            echo "SUCCESS: $user" >> /var/log/spam-folder-fix.log
        else
            echo "FAILED: $user" >> /var/log/spam-folder-fix.log
        fi
    done < /tmp/mailboxes.txt

The above code, creates the folder if it does not exist & then subscribe the folder for the mailboxes. And also logs into the log file for reviewing the status.
 
Back
Top