With the upcoming uberspace 7 the guys at uberspace introduced a new environment with various changes in comparison to u6 (see u7 changelog).
One major aspect is the deprecation of dpsam and spamassassin (which I just managed to setup flawlessly :). However, with U7.1 spam is now handled globally via rspamd.
The following post will show a server-side mail filter that sorts spam, newsletters and service-emails into dedicated folders.
Once spam is detected, the header X-Rspamd-Bar, X-Rspamd-Report and X-Rspamd-Score are attached to the mail. X-Rspamd-Bar contains an spam-indicator based on - and +, e.g. the value +++ indicates quite certainly spam an e-mail flagged with -- might contain some useful contents.
Due to the huge amount of daily spam e-emails it's sensible to perform a server-side sorting via mailfilter as described in the old uberspace wiki.
A good starting point for a modulized mailfilter can be found in macfrogs blog, 2014.
When it comes to actually filter the e-mails, following rules came in handy:
# Here go the filter rules... # Move all mails with a bar greater `+++` to .Junk if ( /^X-Rspamd-Bar:\s\+\+\+[+]/:h ) { DESTDIR="$MAILDIR/.Junk" } # Sort newsletters elsif ( /^List-ID:.*/:h ) { DESTDIR="$MAILDIR/.newsletters" } # Sort e-mails provided by services (e.g. twitter/tumblr). elsif ( /^Delivered-To:.*-*@.*$/:h ) { DESTDIR="$MAILDIR/.services" }
A clutched version of the whole script (based on uberspacece and macfrog) looks like this and needs to be placed in the file ~/.mailfilter:
The stored mailfilter can be activated via account by editing the corresponding .qmail-* file and setting its content to |maildrop.
As always, more verbose configurations with various, differing mailfilters via user, are feasible.