0
OS: Rocky Linux 9.2
Services: Dovecot, Dovecot-Pigeonhole, Postfix, Spamassassin, RoundCube

I'm trying to move emails flagged as spam by postfix and spamassassin to spam folder using Dovecot-Pigeonhole and RoundCube, I made these steps and the filters tab shown at RoundCube but the flagged emails still in the inbox.

P.S. I don't know which action is correct? Add post 4190 in Inbound Rules and block it using Firewalld or, don't add it in Inbound Rules?

— Dovecot —

# ------------- 15-lda.conf -------------
# Should saving a mail to a nonexistent mailbox automatically create it?
lda_mailbox_autocreate = yes

# Should automatically created mailboxes be also automatically subscribed?
lda_mailbox_autosubscribe = yes

protocol lda {
  # Space separated list of plugins to load (default is global mail_plugins).
  mail_plugins = $mail_plugins autocreate sieve quota
}

# ------------- 20-lmtp.conf -------------
protocol lmtp {
  # Space separated list of plugins to load (default is global mail_plugins).
  mail_plugins = $mail_plugins autocreate sieve quota
}

# ------------- 20-managesieve.conf -------------
# Uncomment to enable managesieve protocol:
protocols = $protocols sieve

# Service definitions
service managesieve-login {
  inet_listener sieve {
    port = 4190
  }
}

# Service configuration
protocol sieve {
  managesieve_max_line_length = 65536
  managesieve_implementation_string = Dovecot Pigeonhole
}

# ------------- 90-sieve.conf -------------
plugin {

  # Default line after install Dovecot-Pigeonhole
  sieve = file:~/sieve;active=~/.dovecot.sieve

  # This is Mine
  sieve_default = /etc/dovecot/sieve/default.sieve
}

Now, I have created /etc/dovecot/sieve directory and /etc/dovecot/sieve/default.sieve file inside with the following code:

require ["envelope", "fileinto", "mailbox"];
# rule:[Filtering Spam]
if header :contains "X-Spam-Flag" "YES"
{
    fileinto "Spam";
    stop;
}

I always reading about that directory /etc/roundcube/ but I didn't find it in my system and I know that I can't edit the RoundCube config file from the installed directory because it'll be replaced every upgrade, So it's temporarily until I figured it out, So if anyone can help to create RoundCube settings on /etc/roundcube/ will be great

I have installed RoundCube on a subdomain and modified the SUBDOMAIN/public_html/config/config.inc.php

$config['plugins'] = [
    'archive',
    'zipdownload',

    // This is mine
    'managesieve'
];


$config['managesieve_host'] = 'localhost';
$config['managesieve_default'] = '/etc/dovecot/sieve/default.sieve';

Now, I got a Filters tab on my RoundCube, But unfortunately, RoundCube is unable to create a Spam folder automatically, and even if I create it manually, The Flagged emails don’t move into it.

RoundCube Filters tab shown up

RoundCube cannot create a Spam folder or move spam emails to an exist spam folder

Thank You!

Hady Shaltout
  • 161
  • 2
  • 9

0 Answers0