Zentyal Forum, Linux Small Business Server

Zentyal Server => Email and Groupware => Topic started by: jac2703 on November 18, 2015, 06:09:32 pm

Title: [SOLVED] SPAM not going to junk
Post by: jac2703 on November 18, 2015, 06:09:32 pm
Hi all,

I have a new installation of Zentyal community installed with the mail and mail filtering modules installed.

Incoming mail is being checked, and some of it tagged as SPAM, both in the header and in the subject if I set the option. In webmail, however, it's not being put in the Spam/ Junk folder and just resides in the Inbox.

Is this intended behaviour? Is there a way to get this moved for each user?
Title: Re: SPAM not going to junk
Post by: jbahillo on November 19, 2015, 11:24:21 am
Yes, mailfilter will only tag spam mails, not move then to wherever. You should set a global sieve filter if you want this to be done automatically
Title: Re: SPAM not going to junk
Post by: jac2703 on November 19, 2015, 11:54:59 am
Thanks for the reply, jbahillo.

At least now I understand the expected behaviour.

Where would I set a global sieve filter? Is there a GUI, or do I need to create a rules file somewhere?
Title: Re: SPAM not going to junk
Post by: jbahillo on November 19, 2015, 11:57:28 am
No, ther's no GUI. You will need to read Dovecot + Sieve documentation in order to learn how to do this
Title: Re: SPAM not going to junk
Post by: jac2703 on November 19, 2015, 03:47:25 pm
Thanks.

I've written a quick blog post showing how to do this for anyone else who has this issue.

http://www.jamescoyle.net/how-to/1963-configure-zentyal-4-2-to-move-spam-email-to-junk-folder (http://www.jamescoyle.net/how-to/1963-configure-zentyal-4-2-to-move-spam-email-to-junk-folder)
Title: Re: [SOLVED] SPAM not going to junk
Post by: jbahillo on November 19, 2015, 03:53:44 pm
Hello. Just a small note regarding your article (thx for contributing, by the way)

If you do that way, changes done to dovecot config will be lost once you restart zentyal-mail module. You will need to create a custom stub for that. Custom stubs are documented on doc.zentyal.org
Title: Re: [SOLVED] SPAM not going to junk
Post by: jac2703 on November 19, 2015, 04:54:04 pm
Thanks for the pointer - good to know!

It looks like the sieve config is already defined then, in dovecot.conf.mas.

Once I restarted the zentyal mail service the config was indeed over-written with the templates code as you suggest. The template adds a pointer to /var/vmail/default.sieve which I've created as a below.
Code: [Select]
require ["fileinto"];
# rule:[SPAM]
if header :contains "X-Spam-Flag" "YES" {
        fileinto "Spam";
}

However, it doesn't seem to work. Sending a SPAM message doesn't get placed into the junk folder. Any thoughts?
Title: Re: [SOLVED] SPAM not going to junk
Post by: jbahillo on November 19, 2015, 04:56:23 pm
Rule looks ok, just make sure that the path to the folder is correct - perhaps better using the full path, using the right separator. Perhaps worthy doing a similar rule on webmail itself and loking on sogo.sieve the result