Author Topic: moving spam email to spam folder.  (Read 2113 times)

geo77

  • Zen Apprentice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
moving spam email to spam folder.
« on: May 25, 2019, 07:33:18 pm »
Hi,
I just updgraded from 4.0 to 5.0, and can't update to 6.0, because it breaks my server.
In any case I am using Zentyal 5.0. The update has broken the way I was moving emails marked as SPAM by the mail filters into the users spam folder.
So I had a sieve.sogo file in every user's /var/vmail/domain.com/user folder and that would move the files that had SPAM headings into the spam folder.

Is there some other way that I can accomplish this in 5.0 either at the user or global level?

Thanks for any help..

geo77

  • Zen Apprentice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: moving spam email to spam folder.
« Reply #1 on: May 27, 2019, 02:49:55 pm »
Is there anybody in these forums?

basselope

  • Zen Monk
  • **
  • Posts: 65
  • Karma: +17/-0
    • View Profile
Re: moving spam email to spam folder.
« Reply #2 on: May 28, 2019, 01:17:48 pm »
Sometimes - but mostly other Zentyal users like you.

If you are using the commercial version, you have faster options.

geo77

  • Zen Apprentice
  • *
  • Posts: 6
  • Karma: +0/-0
    • View Profile
Re: moving spam email to spam folder.
« Reply #3 on: May 28, 2019, 03:18:05 pm »
Hi Baseloppe,
Unfortunately, we're not using the commercial version  :(
This lack of support is got me seriously contemplating moving to Nethserver.

If anybody has any idea on dovecot and sieve, please let me know.

doncamilo

  • Zen Samurai
  • ****
  • Posts: 478
  • Karma: +165/-1
    • View Profile
Re: moving spam email to spam folder.
« Reply #4 on: May 29, 2019, 01:18:55 pm »
Hi Baseloppe,
Unfortunately, we're not using the commercial version  :(
This lack of support is got me seriously contemplating moving to Nethserver.

If anybody has any idea on dovecot and sieve, please let me know.


Hi geo77!

Code: [Select]
doveconf namespace

You should found something similar to this:

Code: [Select]
namespace inbox {
  disabled = no
  hidden = no
  ignore_on_failure = no
  inbox = yes
  list = yes
  location =
  mailbox Drafts {
    auto = subscribe
    autoexpunge = 0
    autoexpunge_max_mails = 0
    comment =
    driver =
    special_use = \Drafts
  }
  mailbox Sent {
    auto = subscribe
    autoexpunge = 0
    autoexpunge_max_mails = 0
    comment =
    driver =
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = no
    autoexpunge = 0
    autoexpunge_max_mails = 0
    comment =
    driver =
    special_use = \Sent
  }
  mailbox Spam {
    auto = create
    autoexpunge = 0
    autoexpunge_max_mails = 0
    comment =
    driver =
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    autoexpunge = 0
    autoexpunge_max_mails = 0
    comment =
    driver =
    special_use = \Trash
  }
  order = 0
  prefix =
  separator = /
  subscriptions = yes
  type = private
}


Code: [Select]
sudo doveadm mailbox list -u user@domain.lan
You should found something similar to this:

Code: [Select]
Trash
Drafts
Sent
Spam
INBOX

To move the  spam to the Junk folder, you has to have enabled  sieve script in Dovecot.

Code: [Select]
doveconf plugin
This is my output.

Code: [Select]
plugin {
  quota = maildir:User quota
  quota_rule = *:storage=0
  sieve = /var/vmail/%Ld/%Ln/sieve-script
  sieve_dir = /var/vmail/%Ld/%Ln
  sieve_global_path = /var/vmail/default.sieve
  sieve_storage = /var/vmail/%Ld/%Ln
}

Test your dovecot instance:

Code: [Select]
netcat localhost 4190
"IMPLEMENTATION" "Dovecot (Ubuntu) Pigeonhole"
"SIEVE" "fileinto reject envelope encoded-character vacation subaddress comparator-i;ascii-numeric relational regex imap4flags copy include variables body enotify environment mailbox date index ihave duplicate mime foreverypart extracttext"
"NOTIFY" "mailto"
"SASL" "GSSAPI PLAIN"
"STARTTLS"
"VERSION" "1.0"
OK "Dovecot (Ubuntu) ready."

Create default.sieve into /var/vmail/ # sieve_global_path = /var/vmail/default.sieve

Here you have a sieve script that does te task: https://wiki2.dovecot.org/Pigeonhole/Sieve/Examples

Code: [Select]
require "fileinto";
if header :contains "X-Spam-Flag" "YES" {
  fileinto "Spam";
}

Compile the script:

Code: [Select]
sievec default.sieve
Restart mail service

This should do the trick.


- Do my pigeons bother you passing over your land?
- They block the sun!

G. Guareschi., Don Camillo.,