Author Topic: [SOLVED] SPAM not going to junk  (Read 5595 times)

jac2703

  • Zen Apprentice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
[SOLVED] SPAM not going to junk
« 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?
« Last Edit: November 19, 2015, 03:48:52 pm by jac2703 »

jbahillo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1444
  • Karma: +77/-2
    • View Profile
Re: SPAM not going to junk
« Reply #1 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

jac2703

  • Zen Apprentice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: SPAM not going to junk
« Reply #2 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?

jbahillo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1444
  • Karma: +77/-2
    • View Profile
Re: SPAM not going to junk
« Reply #3 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

jac2703

  • Zen Apprentice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: SPAM not going to junk
« Reply #4 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

jbahillo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1444
  • Karma: +77/-2
    • View Profile
Re: [SOLVED] SPAM not going to junk
« Reply #5 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

jac2703

  • Zen Apprentice
  • *
  • Posts: 4
  • Karma: +0/-0
    • View Profile
Re: [SOLVED] SPAM not going to junk
« Reply #6 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?

jbahillo

  • Zentyal Staff
  • Zen Hero
  • *****
  • Posts: 1444
  • Karma: +77/-2
    • View Profile
Re: [SOLVED] SPAM not going to junk
« Reply #7 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