• 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.

How to get filters to run automatically

D

djbwise

Guest
How to get filters to run automatically (server side)

Is it possible to get the filters(the ones you set in horde webemail) to run automatically, even when webmail is not open? This would be sweet, and let the server side filter work for multiple IMAP clients. Seems it should work this way by default even.
 
Originally posted by djbwise
Is it possible to get the filters(the ones you set in horde webemail) to run automatically, even when webmail is not open? This would be sweet, and let the server side filter work for multiple IMAP clients. Seems it should work this way by default even.

The simple answer is to install maildrop.

this is run when the users .qmail file is parsed

here is an example of a users .qmail file locate at:

/var/qmail/mailnames/DOMAIN.COM/USERNAME/.qmail

with permissions
-rw------- 1 popuser popuser 452 Jun 4 16:17 /var/qmail/mailnames/DOMAIN.COM/USERNAME/.qmail


Code:
| if [ -z "$SA" ]; then export SA=1; /usr/local/psa/bin/psa-spamc -u [email][email protected][/email] -U /tmp/spamd_light.sock > spamcheck$$; if [ -s spamcheck$$ ]; then /var/qmail/bin/qmail-local "$USER" "$HOME" "$LOCAL" "" "" "$HOST" "$SENDER" "$DEFAULT" < spamcheck$$; retval=$?; rm -f spamcheck$$; [ $retval = 0 ] && exit 99; exit $retval; fi; rm -f spamcheck$$; fi # ACCEPT UCE
| true
| /var/qmail/bin/preline /usr/bin/maildrop /etc/mail/mailfilter-extended


the last line of this example forces maildrop to read its filtering rules from /etc/mail/mailfilter-extended.

A working example to filter for spam is show:

Code:
SHELL="/bin/sh"
import EXT
import HOST

import USER
import HOME
import LOCAL
import HOST
import SENDER
import DEFAULT



VPOP="| $VDELIVERMAIL '' bounce-no-mailbox"

MAILDIRMAKE="/usr/bin/maildirmake"
DELIVERQUOTA="/usr/bin/deliverquota"
BOUNCESAYING="/var/qmail/bin/bouncesaying"

MAXMAILSIZE=512000

#logfile "/var/log/maildrop.log"
logfile "maildrop.log"

log " ";
log "====  BEGIN maildrop processing for $EXT@$HOST ==="

log "$USER $HOME $LOCAL $HOST $SENDER $DEFAULT"

#MAILDIRQUOTA=`/usr/bin/head -n1 Maildir/maildirsize`

if ( /^X-Spam-Status: Yes/)
{
        `test -d Maildir/.Spam`   # make sure .Spam folder exists
        if( $RETURNCODE == 1 )
        {
                log "  creating Maildir/.Spam "
                `$MAILDIRMAKE Maildir/.Spam`
                `echo "INBOX.Spam" >> Maildir/courierimapsubscribed`
        }

        log "  SPAM: attempting quota delivery to Maildir/.Spam"
        exception {
                xfilter "$DELIVERQUOTA Maildir/.Spam"
                log "DELIVER TO SPAM DIR"
                log "$DELIVERQUOTA Maildir/.Spam"
        }

        if( $RETURNCODE == 77)
        {
                log "  QUOTA FAILURE: bouncesaying ' over quota'"
                to "|$BOUNCESAYING 'This mail cannot be delivered. $DEFAULT is over quota'"
        }
        log "=== END ===  success"
        exit
}


log "Delivering clean mail to Maildir/"
xfilter "$DELIVERQUOTA Maildir"
log "=== END ==="
log ""
exit;

numerous examples exist online.

have fun
 
But how would this run with the horde/ingo filters? I want users to be able to set rules in horde webmail and have them filter when the message comes in.
 
Back
Top