1 (edited by Schokobecher 2017-02-09 07:24:11)

Topic: Sieve rules failing ( Invalid mailbox name)

======== Required information ====
- iRedMail version (check /etc/iredmail-release):   0.9.6
- Linux/BSD distribution name and version:  Ubuntu 16.04
- Store mail accounts in which backend (LDAP/MySQL/PGSQL):  MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro: No
- Related log if you're reporting an issue:

dovecot.sieve.log of user wrote:

sieve: info: started log at Feb 09 00:12:03.
error: msgid=28108123272099$f3454142a9f74e5198c71f230f5f2b1b: failed to store into mailbox 'INBOX/': Invalid mailbox name: Ends with hierarchy separator.
sieve: info: started log at Feb 09 00:12:17.
error: msgid=<CANXaQcro9f31d512w833XGhnfC14UXZXV5y_ZCBnVjm25WEDYQ@mail.gmail.com>: failed to store into mailbox 'INBOX/': Invalid mailbox name: Ends with hierarchy separator.

====

Hello,

after moving our iRedMail installation to another server,m I ran into a problem with configuring sieve rules on a per-user basis. The rule files (created with RoundCube) get created just fine, but sieve fails to open the right mailbox folders.

Dovecot conf wrote:

# Pigeonhole version 0.4.13 (7b14904)
# OS: Linux 4.4.0-62-generic x86_64 Ubuntu 16.04.1 LTS
auth_master_user_separator = *
auth_mechanisms = PLAIN LOGIN
dict {
  acl = mysql:/etc/dovecot/dovecot-share-folder.conf
  quotadict = mysql:/etc/dovecot/dovecot-used-quota.conf
}
first_valid_uid = 2000
last_valid_uid = 2000
listen = * [::]
mail_debug = yes
mail_gid = 2000
mail_location = maildir:%Lh/Maildir/:INDEX=%Lh/Maildir/
mail_plugins = quota mailbox_alias acl
mail_uid = 2000
managesieve_notify_capability = mailto
managesieve_sieve_capability = 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
namespace {
  inbox = yes
  location =
  mailbox Archive {
    auto = no
    special_use = \Archive
  }
  mailbox Archives {
    auto = no
    special_use = \Archive
  }
  mailbox "Deleted Messages" {
    auto = no
    special_use = \Trash
  }
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = subscribe
    special_use = \Junk
  }
  mailbox "Junk E-mail" {
    auto = no
    special_use = \Junk
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Items" {
    auto = no
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    auto = no
    special_use = \Sent
  }
  mailbox Spam {
    auto = no
    special_use = \Junk
  }
  mailbox Trash {
    auto = subscribe
    special_use = \Trash
  }
  prefix =
  separator = /
  type = private
}
namespace {
  list = children
  location = maildir:%%Lh/Maildir/:INDEX=%%Lh/Maildir/Shared/%%Ld/%%Ln
  prefix = Shared/%%u/
  separator = /
  subscriptions = yes
  type = shared
}
passdb {
  args = /etc/dovecot/dovecot-mysql.conf
  driver = sql
}
passdb {
  args = /etc/dovecot/dovecot-master-users
  driver = passwd-file
  master = yes
}
plugin {
  acl = vfile
  acl_shared_dict = proxy::acl
  auth_socket_path = /var/run/dovecot/auth-master
  mailbox_alias_new = Sent Messages
  mailbox_alias_new2 = Sent Items
  mailbox_alias_old = Sent
  mailbox_alias_old2 = Sent
  quota = dict:user::proxy::quotadict
  quota_grace = 10%%
  quota_rule = *:storage=1G
  quota_warning = storage=100%% quota-warning 100 %u
  quota_warning2 = storage=95%% quota-warning 95 %u
  quota_warning3 = storage=90%% quota-warning 90 %u
  quota_warning4 = storage=85%% quota-warning 85 %u
  sieve = %Lh/sieve/dovecot.sieve
  sieve_before = /var/vmail/sieve/dovecot.sieve
  sieve_dir = %Lh/sieve
  sieve_global_dir = /var/vmail/sieve
  sieve_max_redirects = 30
}
protocols = pop3 imap sieve lmtp
service auth {
  unix_listener /var/spool/postfix/private/dovecot-auth {
    group = postfix
    mode = 0666
    user = postfix
  }
  unix_listener auth-master {
    group = vmail
    mode = 0666
    user = vmail
  }
  unix_listener auth-userdb {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service dict {
  unix_listener dict {
    group = vmail
    mode = 0660
    user = vmail
  }
}
service imap-login {
  process_limit = 500
  service_count = 1
}
service lmtp {
  executable = lmtp -L
  inet_listener lmtp {
    address = 127.0.0.1
    port = 24
  }
  process_min_avail = 5
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
  user = vmail
}
service managesieve-login {
  inet_listener sieve {
    address = 127.0.0.1
    port = 4190
  }
}
service pop3-login {
  service_count = 1
}
service quota-warning {
  executable = script /usr/local/bin/dovecot-quota-warning.sh
  unix_listener quota-warning {
    group = vmail
    mode = 0660
    user = vmail
  }
}
ssl = required
ssl_cert = </etc/letsencrypt/live/mail.pcteufel-gifhorn.de/fullchain.pem
ssl_cipher_list = EECDH+AESGCM:EDH+AESGCM:AES256+EECDH:AES256+EDH
ssl_dh_parameters_length = 2048
ssl_key = </etc/letsencrypt/live/mail.pcteufel-gifhorn.de/privkey.pem
ssl_prefer_server_ciphers = yes
ssl_protocols = !SSLv2 !SSLv3
syslog_facility = local5
userdb {
  args = /etc/dovecot/dovecot-mysql.conf
  driver = sql
}
protocol lda {
  auth_socket_path = /var/run/dovecot/auth-master
  lda_mailbox_autocreate = yes
  lda_mailbox_autosubscribe = yes
  mail_plugins = quota mailbox_alias acl sieve
  postmaster_address = root
}
protocol lmtp {
  lmtp_save_to_detail_mailbox = yes
  mail_plugins = quota sieve
  postmaster_address = postmaster
  recipient_delimiter = +
}
protocol imap {
  imap_client_workarounds = tb-extra-mailbox-sep
  mail_max_userip_connections = 30
  mail_plugins = quota mailbox_alias acl imap_quota imap_acl
}
protocol pop3 {
  mail_max_userip_connections = 30
  mail_plugins = quota mailbox_alias acl
  pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
  pop3_uidl_format = %08Xu%08Xv
}

and the test sieve rule:

dovecot.sieve wrote:

require ["fileinto"];
# rule:[Test]
if header :is "from" "myemail@gmail.com"
{
        fileinto "INBOX/Personal";
}

Any ideas?



Cheers!

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: Sieve rules failing ( Invalid mailbox name)

Schokobecher wrote:

        fileinto "INBOX/Personal";

Try "INBOX.Personal".

3 (edited by Schokobecher 2017-02-09 17:34:07)

Re: Sieve rules failing ( Invalid mailbox name)

I tried that, but it seems to be ignored?

sieve: info: started log at Feb 09 09:41:01.
error: msgid=<CANXaQcrA=wPPuPdF3XBEZqj6OyyjYRqt+C1gOJL41vRSau6Xeg@mail.gmail.com>: failed to store into mailbox 'INBOX/': Invalid mailbox name: Ends with hierarchy separator.

While the sieve rule looks like that:

# rule:[Test]
if header :is "from" "myemail@gmail.com"
{
        fileinto "INBOX.Personal";
}

Is it correct that RoundCube creates it's own xxxxx.sieve and it's content are also in dovecot.sieve.

Even a rule like:

require ["vacation"];
# rule:[Test]
if header :is "subject" "Test"
{
        vacation :days 1 :addresses "info@mydomain.tld" :subject "Test Test" :from "info@mydomain.tld" "Test!";
}

produces the same error and doesn't send an email back. I had sieve working on the old machine just fine, did a manual backup (copy of /var/vmail + the Databases excluding 'mysql') and imported it back into the new server. Something broke there?

4

Re: Sieve rules failing ( Invalid mailbox name)

Schokobecher wrote:

error: msgid=<CANXaQcrA=wPPuPdF3XBEZqj6OyyjYRqt+C1gOJL41vRSau6Xeg@mail.gmail.com>: failed to store into mailbox 'INBOX/': Invalid mailbox name: Ends with hierarchy separator.

The error means old sieve rule was used. Please try to remove "*.sievec" under same directory, this way Dovecot will re-compile the sieve file.

5

Re: Sieve rules failing ( Invalid mailbox name)

I removed *.sievec and *.svbin files and also checked the newly created dovecot.svbin and it shows "INBOX.Personal"

Problem still exists, same message hmm

6

Re: Sieve rules failing ( Invalid mailbox name)

For testing purpose, does it work if you change the mail folder name to, e.g. Junk, Draft, Sent, or other new folder name without a dot or a '/'?

7 (edited by Schokobecher 2017-02-10 18:03:23)

Re: Sieve rules failing ( Invalid mailbox name)

I removed the dovecot.svbin, the new rule looks like this:

dovecot.sieve wrote:

require ["fileinto"];
# rule:[Test]
if header :is "from" "myemail@gmail.com"
{
        fileinto "Drafts";
}


dovecot.sieve.log wrote:

sieve: info: started log at Feb 10 10:14:50.
error: msgid=<CANXaQcqxJLciTMWjOgWb_wrVqUNgvM+hs2CNQ52GR+nYpONPEg@mail.gmail.com>: failed to store into mailbox 'INBOX/': Invalid mailbox name: Ends with hierarchy separator.

Very very strange.

I also checked the global sieve rule in '/var/vmail/sieve' and it only has the default "Move Emails with Spam Header into Spam"

8

Re: Sieve rules failing ( Invalid mailbox name)

Do you use SOGo or Roundcube to manage sieve rules?