OX Open-Xchange SpamAssasin filter rule

Now that I have a working OX App Suit solution installed I’d like to move automatically Spam signed from SpamAssasin to Spam folder.

First question: does OX App Suit include already a working Spam filter rule or do I have to create a new rule for every user?

I checked on UCR and I have:

|mail/antispam/autostart|yes|
|mail/antispam/bodysizelimit|300|
|mail/antispam/headertag||
|mail/antispam/learndaily|yes|
|mail/antispam/ox/spamrunner|yes|
|mail/antispam/ox/spamrunner/cron||
|mail/antispam/ox/spamrunner/verbose||
|mail/antispam/requiredhits|3.0|
|mail/antispam/rules/autoupdate|yes|
|mail/antivir/spam|yes|
|mail/dovecot/folder/spam|Spam|
|mail/dovecot/mailboxes/auto/Spam|no|
|mail/dovecot/mailboxes/special/Archive|\Archive|
|mail/dovecot/mailboxes/special/confirmed-spam|\Junk|
|mail/dovecot/mailboxes/special/Drafts|\Drafts|
|mail/dovecot/mailboxes/special/Entwürfe|\Drafts|
|mail/dovecot/mailboxes/special/Gesendete Objekte|\Sent|
|mail/dovecot/mailboxes/special/Junk|\Junk|
|mail/dovecot/mailboxes/special/Papierkorb|\Trash|
|mail/dovecot/mailboxes/special/Sent|\Sent|
|mail/dovecot/mailboxes/special/Sent Messages|\Sent|
|mail/dovecot/mailboxes/special/Spam|\Junk|
|mail/dovecot/mailboxes/special/Trash|\Trash|
|mail/dovecot/sieve/spam|yes|
|mail/postfix/greylisting|enabled|
|mail/postfix/smtpd/restrictions/recipient/76|reject_rbl_client zen.spamhaus.org|
|mail/smtp/VRFY/disabled||
|ox/cfg/imap.properties/com.openexchange.imap.spamHandler|SpamAssassin|

In particular:

|mail/dovecot/sieve/spam|yes|
If this option is activated or the variable unset, a Sieve script is created for every new mailbox, which moves spam mails into the spam folder (see ‘mail/dovecot/folder/spam’).

Even if this option is set to YES, no Sieve script is automatically created for Spam.

Other thing: after OX App Suite installation I have some new mail folders:

|mail/dovecot/mailboxes/special/Entwürfe|\Drafts|
|mail/dovecot/mailboxes/special/Gesendete Objekte|\Sent|
|mail/dovecot/mailboxes/special/Papierkorb|\Trash|
|mail/dovecot/mailboxes/special/confirmed-spam|\Junk|

Is it normal? I already have these folder, can I delete these entries from UCR?

When OX was installed, this UCRV should have been set to no. OX handles spam differently that the UCS mail system.
In OX each user has a confirmed-spam and confirmed-ham folder. If the user moves spam email messages into confirmed-spam, the bayesian spam filter then runs each day will learn from that.

A sieve script will be created for every new mailbox from then on. (You may have to restart the listener for the change to take effect.)

Please don’t. Those UCRVs configure Dovecot to assign SPECIAL-USE RFC 6154 tags to mailboxes. Those tags are sent to email clients so they know what a folder is for (Gesendete Objekte is for sent email, Papierkorb is for trash, etc). See the UCR help text (ucr search --verbose mail/dovecot/mailboxes/special).

Thanks @troeder I changed |mail/dovecot/sieve/spam|yes| to NO and I keep all mail/dovecot/mailbox/special/ folders. My problem with these folders is that now in my mail client (Apple Mail) I have these new folders even if I already have a Sent Mail folder, Trash folder, etc…

About the use of confirmed-spam and confirmed-ham, is it the same on Spam and Ham folder that I already have? I mean, does the bayesian spam filter runs only in these 2 new folders? Before installing OX App Suite i used Ham and Spam folders.

Last question: what about a Spam filter to move automatically mail marked as Spam from SpamAssasion to Spam folder? Does OX do something? I tried to create a filter rule from OX that insert this inside my Open-Xchange.sieve file:

# Generated by OX Sieve Bundle on Wed Jun 26 13:51:30 CEST 2019
require [ "fileinto" ];

## Flag: |UniqueId:0|Rulename: Spam
if header :contains "X-Spam-Level" "***" 
{
    fileinto "Spam" ;
}

Could be correct? Is this the way?

You can move existing messages into the new folders and delete the old folders. They are not required. Best would be to reconfigure your desktop application to use the new folders.
Generally OX optimizes their product for use with the Web UI (which has a button for marking messages as Sp[H]am and moving it into the respective folders).

I don’t know Apple Mail, but it’s probably the same. Thunderbird has a similar feature.
The difference is, that the email clients learn only from your personal mail, while the server learns from the mails of all users.
Both have advantages:

  • Learning from personal mail will tune the bayesian filter to your personal messages, lowering especially false-positives.
  • Learning from the messages of all users means a) having more input for the bayesian filter and b) users profiting from the classification already done by other users of the same system.

Spam is scanned every hour (see /etc/cron.d/univention-ox-spamrunner) and after scanning, messages are expunged from confirmed-spam and confirmed-ham (see /usr/sbin/spamrunner).

Sorry @troeder, I’m a bit confused about mail folders.

Before installing OX App Suite I had a normal UCS Mail Server installation + SpamAssasin with Sent, Drafts, Trash, Junk folders. As the UCS manual said in chapter 14.4 (Spam detection and filtering):

"E-mails which are classified as Spam - because they exceed a certain number of points - are not delivered to the recipient’s inbox by Dovecot, but rather in the Spam folder below it. The name of the folder for Spam can be configured with the Univention Configuration Registry variable mail/dovecot/folder/Spam . The filtering is performed by a Sieve script, which is automatically generated when the user is created…

There is also the possibility of evaluating e-mails with a Bayes classifier. This compares an incoming e-mail with statistical data already gathered from processed e-mails and uses this to adapt it’s evaluation to the user’s e-mail. The Bayes classification is controlled by the user himself, whereby e-mails not identified as Spam by the system can be placed in the Spam subfolder by the user and a selection of legitimate e-mails copied into the Ham ( mail/dovecot/folder/ham ) subfolder. This folder is evaluated daily and data which have not yet been collected or were previously classified incorrectly are collected in a shared database. This evaluation is activated in the default setting and can be configured with the Univention Configuration Registry variable mail/antispam/learndaily .

The Spam filtering can be deactivated by setting the Univention Configuration Registry variable mail/antivir/spam to no . When modifying Univention Configuration Registry variables concerning Spam detection, the AMaViS service and Postfix must be restarted subsequently."

Until now everything is clear, but after installing OX App Suite I didn’t understand if the original working spam method reported in manual still working or not. I still have |mail/antivir/spam|yes| and I still have Spam folder and Ham folder. Does OX App Suite disable this original configuration?

Next, from your reply I understood that OX App Suite automatically create Entwürfe, Gesendete, Papierkorb, confirmed-spam, confirmed-ham folders. I can see these new folders in Apple Mail Client, in Thunderbird and eM Client, but I still confused. Why OX App Suite create new Entwürfe (Draft), Gesendete (Sent), Papierkorb (Trash) folders with dutch names? I’d like to continue to use my original folders for Sent, Draft and Trash and I’d like to delete or don’t use Entwürfe, Gesendete, Papierkorb folders. Is it possible?

I understood that confirmed-spam and confirmed-ham has the same function of original Ham and Spam folders from UCS manual. Could you confirm me that OX App Suite with “/etc/cron.d/univention-ox-spamrunner” will check confirmed-mail and confirmed-spam folder and “mail/antispam/learndaily” will check Ham and Spam folders?

The OX app does indeed replace the UCS spam filter mechanism.

OX does indeed create the default folders by default with German names (it is a German company). But both the administrator and users can change the folders names:

The defaults are set in /opt/open-xchange/etc/AdminUser.properties. Please use UCR for settings in .property files. For example usage look at

ucr search ^ox/cfg/AdminUser.properties/

OX configuration options are explained here: https://documentation.open-xchange.com/components/middleware/config/7.10.2/

Users can set the folders they want to use for sent/trash/etc in settings→accounts.

Thanks @troeder, everything is becoming much clear after some attempts.

As you suggested, I moved Sent messages form Sent folder to Gesendete Objekte folder and after I deleted Sent Folder. I changed default folders in Mail Client on desktop and smartphone. I did it in for my account, now the hard work will be make these changes to all existing account.

For Spam mechanism I didn’t understand if OX App Suite move automatically Spam messages marked by SpamAssasin into confirmed-spam folder or if this folder is used only for spam marked manually by users.

I tested a Sieve Filter in my account to move automatically Spam marked with *** or more hits by SpamAssasin and is working very well:

# Generated by OX Sieve Bundle on Wed Jun 26 13:51:30 CEST 2019
require [ "fileinto" ];

## Flag: |UniqueId:0|Rulename: Spam
if header :contains "X-Spam-Level" "***" 
{
    fileinto "Spam" ;
}

Could be a solution?

Hello,
back from holidays - sorry for the late answer.
AFAIK confirmed-spam is only used when messages are manually marked by users.
The Sieve filter looks good.

Greetings
Daniel Tröder

Hello, @troeder my system marked spam mails and changed the header using SpamAssassin to SPAM. Now I want to put all the SPAM mail to the junk folder for all the users automatically. What to do?

Thanks in advance.

where is this file located???

Moving mails is done in Sieve scripts. They are located in the users mail directory: /var/spool/dovecot/private/<domain>/<user>/sieve.

Mastodon