1 (edited by Thierry 2016-03-21 14:18:35)

Topic: Moving spam to Junk folder not working

======== Required information ====
- iRedMail version (check /etc/iredmail-release): 0.9.3
- Linux/BSD distribution name and version: Debian 8
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): Mysql
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? No
- Related log if you're reporting an issue:
====
Hi,

I am storing my emails to: /var/vmail/vmail1 and I am now using in front of my emails server the EFA ...
The EFA should send spam emails with "X-Spam-Status: Yes" to my email server, but I have never received any emails in this folder yet .... If I am checking from EFA, There is a certain numbers of spams ....

My dovecot.conf:

...
sieve_global_dir = /var/vmail/sieve
...
sieve_before = /var/vmail/vmail1/sieve/dovecot.sieve

Folders:

/var/vmail/vmail1# ls -l
total 16
drwx------  4 vmail vmail 4096 sept. 12  2015 2015
-rwx------  1 vmail vmail  116 nov.  13 11:22 dovecot.sieve
-rwx------  1 vmail vmail  193 nov.  13 11:22 dovecot.svbin
drwx------ 13 vmail vmail 4096 mars  19 11:53 domain.ltd

And what in /var/vmail:

/var/vmail# ls -l
total 12
drwxr-xr-x 3 root  root  4096 août  12  2015 backup
drwx------ 2 vmail vmail 4096 août  11  2015 sieve
drwx------ 4 vmail vmail 4096 nov.  13 11:22 vmail1

My dovecot.sieve config:

require ["fileinto"];

# rule:[Move Spam to Junk Folder]
if header :is "X-Spam-Status" "YES"
{
    fileinto "Spam";
}

Did you see something wrong ?

Thx

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Moving spam to Junk folder not working

Two observations:

1. Do you have a folder called "spam" in your system at all? Seems more customary to have "Junk".

2. On the systems I know the mail header is called "X-Spam-Flag", not "X-Spam-Status", so the rule reads:

if header :is "X-Spam-Flag" "YES"
{
  fileinto "Junk";
  stop;
}

3

Re: Moving spam to Junk folder not working

Note: if you want to check the mail folders on file system, please run 'ls' command with at least '-a' flag to see hidden files/directories. All IMAP folders (except INBOX folder) are hidden directories, e.g. the Junk folder you see in webmail/Outlook/Thunderbird/... is actually '.Junk' (there's a prefixed dot) on file system.

4

Re: Moving spam to Junk folder not working

pschulz wrote:

Two observations:

1. Do you have a folder called "spam" in your system at all? Seems more customary to have "Junk".


2. On the systems I know the mail header is called "X-Spam-Flag", not "X-Spam-Status", so the rule reads:

if header :is "X-Spam-Flag" "YES"
{
  fileinto "Junk";
  stop;
}

Yes i have a folder called "Spam"
No, the EFA write on the header of the email "X-Spam-Status" not "X-Spam-Flag" so i have change it on the "dovecot.sieve"

For the "fileinto" do I have to add the prefixed dot or not ?

Thx

5

Re: Moving spam to Junk folder not working

Thierry wrote:

For the "fileinto" do I have to add the prefixed dot or not ?

No.

6 (edited by Thierry 2016-03-25 00:33:13)

Re: Moving spam to Junk folder not working

seems not to work ....
I have made some change ...

From EFA I have this:

Spam:     Y   Action(s): deliver, header, "X-Spam-Status:Yes"

dovecot.sieve :

require "fileinto";

# rule:[Move Spam to Junk Folder]
if header :contains "X-Spam-Status" "Yes" {
    fileinto "Spam";
}

7

Re: Moving spam to Junk folder not working

Please turn on debug mode in Dovecot, restart Dovecot, then send testing email again. Check Dovecot log file /var/log/dovecot-sieve.log to see if there's any useful log.
Reference: http://www.iredmail.org/docs/debug.dovecot.html

By the way, this is default sieve rule used in iRedMail:

require ["fileinto"];

# rule:[Move Spam to Junk Folder]
if header :is "X-Spam-Flag" "YES"
{
    fileinto "Junk";
}