• Halloween is coming! To celebrate the occasion, we dusted off a couple of old skins, and even created a brand new one (Pixel).
    To get into the festive spirit, install the Skins extension.
  • The new Python extension is now available. It allows customers to deploy and manage WSGI-based Python applications on their websites directly from Plesk.
  • The Plesk Mobile apps for iOS and Android and the Plesk Mobile Center extension have been deprecated, and are no longer available for new installations. In Plesk Obsidian 18.0.84, the Plesk Mobile Center extension will be removed from servers during the upgrade, and the Plesk Mobile apps will lose their server management features.
  • The Social Login extension has been deprecated and will be removed in Plesk Obsidian 18.0.84. After that, it will no longer be possible to log in to Plesk with a Google, Facebook, GitHub account, or with a passkey. Plesk usernames and passwords, as well as logging in with a WebPros Account, are not affected.

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