Dear all,

I migrated a dovecot installation that was using pam to a virtual setup where users are stored in a SQL database.

I see that my old pam based installation on the filesystem directories are starting with a dot.
The new server does not have the leading dot.

So even if the configuration is mostly equal, I cannot find a reason why dovecot changed its behavior here. I do not define a separator in the dovecot configuration and the same dovecot package on FreeBSD is used for both installations.

My problem is now, that I use a rather complex sieve script to automatically sort mailinglist based emails automatically into subfolders. But as this script is using a dot it is now not moving the email into a nested directory like:
github/haproxy/haproxy

but is generating a flat directory (depth 1) as
github.haproxy.haproxy

I cannot change the behavior of dovecot, as I have several users running there and I do not want to cause problem for them changing the dovecot configuration.

So I must modify the sieve script.
As I do not really know the sieve syntax, I would like to ask if hopefully someone here can help me. I think is is necessary to change the dots to slashes before the fileinto is executed.

The sievescript I use to sort mailing based emails into subfolder is:
#
# 2016-5-2 Script to sort mailing list mails automatically to folders
#
##
require [ "regex", "include", "variables", "fileinto", "envelope", "mailbox", "imap4flags", "vnd.dovecot.debug" ];
global ["sender_userpart", "sender_domain", "listname"];

# split out the various list forms
# Mailman & other lists using list-id
if exists "list-id" {
  fileinto :create "${listname}";
  stop;
}
# Listar and mailman like
elsif exists "x-list-id" {
  debug_log "Mailinglist: x-list-id found";
  if header :regex "x-list-id" "<([a-z_0-9-]+)\\\\." {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
  } else {
    keep;
  }
  stop;
}
# Ezmlm
elsif exists "mailing-list" {
  debug_log "Mailinglist: mailing-list found";
  if header :regex "mailing-list" "([a-z_0-9-]+)@" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
  } else {
    keep;
  }
  stop;
}
# York lists service
elsif exists "x-mailing-list" {
  debug_log "Mailinglist: x-mailing-list found";
  if header :regex "x-mailing-list" "^\\\\s*([a-z_0-9-]+)@?" {
    set :lower "listname" "${1}";
    fileinto :create "${listname}";
  } else {
    keep;
  }
  stop;
}
# Smartlist
elsif exists "x-loop" {
  debug_log "Mailinglist: x-loop found";
        if header :regex "x-loop" "^\\\\s*(a-z_0-9-]+)@?" {
                set :lower "listname" "${1}";
                fileinto :create "${listname}";
        } else {
            keep;
        }
    stop;}
# poorly identified
elsif envelope :contains "from" "owner-" {
  debug_log "Mailinglist: poorly identified matched";
    if envelope :regex "from" "owner-([a-z_0-9-]+)-outgoing@" {
        set :lower "listname" "${1}";
        fileinto :create "${listname}";
    } elsif envelope :regex "from" "owner-([a-z_0-9-]+)@" {
        set :lower "listname" "${1}";
        fileinto :create "${listname}";
    } elsif header :regex "Sender" "owner-([a-z_0-9-]+)@" {
        set :lower "listname" "${1}";
        fileinto :create "${listname}";
    } else {
        keep;
    }
    stop;}
# other poorly identified
elsif  envelope :contains "from" "-request" {
    if envelope :regex "from" "([a-z_0-9-]+)-request@" {
        set :lower "listname" "${1}";
        fileinto :create "${listname}";
    } else {
        keep;
    }
    stop;
}

Thanks a lot!

Gruß
Matthias

--

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook

_______________________________________________
dovecot mailing list -- dovecot@dovecot.org
To unsubscribe send an email to dovecot-le...@dovecot.org

Reply via email to