0

I've followed this http://sealedabstract.com/code/nsa-proof-your-e-mail-in-2-hours/ tutorial, adjusted to allow for vimbadmin3 users, to set up my mail server. Most of my adjustments come from https://github.com/opensolutions/ViMbAdmin/wiki/Mail-System-Install-on-Ubuntu

The first tutorial uses the dovecot sieve (I think) plugin to route things through dspam. sieve aparently needs a .dovecot.sieve file in the users maildir.

How can I make sure that file is created when dovecot initiates new user maildirs?

Is there a way to create the file in one location, and tell dovecot/sieve to use it on all email accounts?

The file needs to contain:

require ["regex", "fileinto", "imap4flags"];
# Catch mail tagged as Spam, except Spam retrained and delivered to the mailbox
if allof (header :regex "X-DSPAM-Result" "^(Spam|Virus|Bl[ao]cklisted)$",
      not header :contains "X-DSPAM-Reclassified" "Innocent") {
  # Mark as read
  setflag "\\Seen";
  # Move into the Junk folder
  fileinto "Spam";
  # Stop processing here
  stop;
}

I'm running Ubuntu 14.04, using dovecot and postfix. I'm creating users in vimbadmin3, so their directory is not created until their first email is received.

Thanks!

David R.
  • 607
  • 3
  • 6
  • 18
  • Why can't you use `sieve_before` or `sieve_after`? More info in [doc](http://wiki2.dovecot.org/Pigeonhole/Sieve/Configuration) – clement Aug 04 '14 at 12:42
  • The perils of working on something all day, finally asking for help, and then discovering the right documentation just after posting... I did find ```sieve_default```. And, if the errors I see complaining about file perms are any indication, it's trying to use the default sieve script I told it to. :) Thanks for the comment. Those are exactly the docs I needed to find. – David R. Aug 04 '14 at 16:33

1 Answers1

0

There is no need to create this special fiel in every Maildir, use the configuration variable sieve_before. To cite the docs:

sieve_before =

Path to a script file or a directory containing script files that need to be executed before the user's script. If the path points to a directory, all the Sieve scripts contained therein (with the proper .sieve extension) are executed. The order of execution is determined by the file names, using a normal 8bit per-character comparison.

Using sieve_default would not be the right way to go, because the script specified with this option is only used, when the user has no own script configured! Using sieve_before allows you, to always execute it, irrespective of what the user does himself.

sebix
  • 4,175
  • 2
  • 25
  • 45