sieve - Failed to store into mailbox 'INBOX/${1}': Mailbox doesn't exist: INBOX/${1}

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

sieve - Failed to store into mailbox 'INBOX/${1}': Mailbox doesn't exist: INBOX/${1}

Ludovic Terrier
Hello,

First of all, happy new year!

I’ve recently configured my mail server and was using a simple sieve rule in order to store all my ‘[hidden email]’ ingoing email to be stored in the INBOX/pattern folder.
This setup worked very well. I restarted my server this morning (don’t know if it’s related…) and since Dovecot keep storing my emails in INBOX with following errors:

root@server:~# cat /var/mail/vhosts/example.com/ludovic/.dovecot.sieve.log
sieve: info: started log at Jan 01 12:13:56.
error: msgid=<[hidden email]>: failed to store into mailbox 'INBOX/${1}': Mailbox doesn't exist: INBOX/${1}.

Sieve script:
root@server:~# cat /var/mail/vhosts/example.com/ludovic/sieve/roundcube.sieve
require ["envelope","fileinto","subaddress"];
if header :contains "X-Spam-Flag" "YES"
{
        fileinto "Junk";
}
if envelope :detail :matches "to" "*"
{
        fileinto "INBOX/${1}";
}
# rule:[contact]
if allof (header :contains "to" "[hidden email]")
{
        fileinto "INBOX/contact";
        stop;
}

I don’t remember having made recent change in my Dovecot config… only adding the last rule in the sieve script.
Any hint?
Thanks.

Please find below more info of my Dovecot setup (quite long). Is it better to use some pastebin for such long info?

Regards,

-----------------------------------------------------------------------------------------------------------------------------------------------------------------
Info (version and dovecot -n):

root@server:~# dovecot --version
2.2.27 (c0f36b0)

root@helios:~# dovecot -n
# 2.2.27 (c0f36b0): /etc/dovecot/dovecot.conf
# Pigeonhole version 0.4.16 (fed8554)
doveconf: Warning: service auth { client_limit=1000 } is lower than required under max. load (1524)
# OS: Linux 4.9.0-4-amd64 x86_64 Debian 9.3
auth_cache_size = 10 M
auth_username_format = %Ln
first_valid_uid = 999
imap_idle_notify_interval = 29 mins
last_valid_uid = 999
mail_attachment_dir = /var/mail/attachments
mail_attachment_min_size = 64 k
mail_fsync = never
mail_home = /var/mail/vhosts/%d/%n
mail_location = mdbox:~/mdbox
mail_privileged_group = vmail
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 imapsieve
namespace inbox {
  inbox = yes
  location =
  mailbox Archive {
    auto = subscribe
    special_use = \Archive
  }
  mailbox Drafts {
    auto = subscribe
    special_use = \Drafts
  }
  mailbox Junk {
    auto = create
    special_use = \Junk
  }
  mailbox Sent {
    auto = subscribe
    special_use = \Sent
  }
  mailbox "Sent Messages" {
    special_use = \Sent
  }
  mailbox Trash {
    auto = create
    special_use = \Trash
  }
  prefix =
  separator = /
}
passdb {
  args = /etc/dovecot/dovecot-ldap.conf.ext
  driver = ldap
}
plugin {
  imapsieve_mailbox1_before = file:/etc/dovecot/sieve/report-spam.sieve
  imapsieve_mailbox1_causes = COPY
  imapsieve_mailbox1_name = Junk
  imapsieve_mailbox2_before = file:/etc/dovecot/sieve/report-ham.sieve
  imapsieve_mailbox2_causes = COPY
  imapsieve_mailbox2_from = Junk
  imapsieve_mailbox2_name = *
  recipient_delimiter = +
  sieve = file:~/sieve;active=~/.dovecot.sieve
  sieve_after = /usr/local/etc/dovecot/sieve-after.d
  sieve_before = /usr/local/etc/dovecot/sieve-before.d
  sieve_global_extensions = +vnd.dovecot.pipe
  sieve_pipe_bin_dir = /etc/dovecot/sieve
  sieve_plugins = sieve_imapsieve sieve_extprograms
  sieve_quota_max_storage = 50M
}
protocols = " imap lmtp sieve sieve"
service auth-worker {
  user = vmail
}
service auth {
  unix_listener /var/spool/postfix/private/auth {
    group = postfix
    mode = 0660
    user = postfix
  }
}
service imap-login {
  inet_listener imap {
    address = 127.0.0.1, ::1
  }
  process_min_avail = 2
  service_count = 0
  vsz_limit = 1 G
}
service imap {
  process_min_avail = 2
  service_count = 256
}
service lmtp {
  unix_listener /var/spool/postfix/private/dovecot-lmtp {
    group = postfix
    mode = 0600
    user = postfix
  }
}
service pop3-login {
  inet_listener pop3 {
    port = 0
  }
  inet_listener pop3s {
    port = 0
  }
}
ssl = required
ssl_cert = </etc/letsencrypt/pem/server.example.com.pem
ssl_cipher_list = ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256
ssl_dh_parameters_length = 2048
ssl_key =  # hidden, use -P to show it
ssl_prefer_server_ciphers = yes
ssl_protocols = !SSLv3 !TLSv1 !TLSv1.1 TLSv1.2
userdb {
  args = uid=vmail gid=vmail home=/var/mail/vhosts/%d/%n
  driver = static
}
protocol lmtp {
  mail_fsync = optimized
  mail_plugins = " sieve"
}
protocol lda {
  mail_fsync = optimized
  mail_plugins = " sieve"
}
protocol imap {
  mail_max_userip_connections = 50
  mail_plugins = " imap_sieve »
}
-----------------------------------------------------------------------------------------------------------------------------------------------------------------


Ludovic

Reply | Threaded
Open this post in threaded view
|

Re: sieve - Failed to store into mailbox 'INBOX/${1}': Mailbox doesn't exist: INBOX/${1}

Stephan Bosch-2
Op 1/1/2018 om 1:04 PM schreef Ludovic Terrier:

> Hello,
>
> First of all, happy new year!
>
> I’ve recently configured my mail server and was using a simple sieve rule in order to store all my ‘[hidden email]’ ingoing email to be stored in the INBOX/pattern folder.
> This setup worked very well. I restarted my server this morning (don’t know if it’s related…) and since Dovecot keep storing my emails in INBOX with following errors:
>
> root@server:~# cat /var/mail/vhosts/example.com/ludovic/.dovecot.sieve.log
> sieve: info: started log at Jan 01 12:13:56.
> error: msgid=<[hidden email]>: failed to store into mailbox 'INBOX/${1}': Mailbox doesn't exist: INBOX/${1}.
>
> Sieve script:
> root@server:~# cat /var/mail/vhosts/example.com/ludovic/sieve/roundcube.sieve
> require ["envelope","fileinto","subaddress"];
> if header :contains "X-Spam-Flag" "YES"
> {
> fileinto "Junk";
> }
> if envelope :detail :matches "to" "*"
> {
> fileinto "INBOX/${1}";
> }
> # rule:[contact]
> if allof (header :contains "to" "[hidden email]")
> {
> fileinto "INBOX/contact";
> stop;
> }
>
> I don’t remember having made recent change in my Dovecot config… only adding the last rule in the sieve script.
> Any hint?
> Thanks.
>
> Please find below more info of my Dovecot setup (quite long). Is it better to use some pastebin for such long info?

The problem makes sense. The use of the ":matches" match type with
"${1}" used in the if block hints that the "variables" extension is
supposed to be used. However, it is not listed in the require line. In
that case any variables substitution is ignored, causing the error
you're seeing.

If this is what RoundCube outputs, there's something wrong with RoundCube.

Regards,

Stephan.

Reply | Threaded
Open this post in threaded view
|

Re: sieve - Failed to store into mailbox 'INBOX/${1}': Mailbox doesn't exist: INBOX/${1}

Ludovic Terrier

> The problem makes sense. The use of the ":matches" match type with
> "${1}" used in the if block hints that the "variables" extension is
> supposed to be used. However, it is not listed in the require line. In
> that case any variables substitution is ignored, causing the error
> you're seeing.

Thanks for the explanation.

> If this is what RoundCube outputs, there's something wrong with RoundCube.

Yes, I tried adding a new rule via the managesieve’s Roundcube plugin and here’s a comparison with a backup taken just before:

root@server:/var/mail/vhosts/example.com/ludovic/sieve# diff -u roundcube.sieve.bak roundcube.sieve
--- roundcube.sieve.bak 2018-01-02 20:38:36.191983062 +0100
+++ roundcube.sieve 2018-01-02 20:40:03.457553541 +0100
@@ -1,4 +1,4 @@
-require ["envelope","fileinto","subaddress","variables","mailbox"];
+require ["envelope","fileinto","imap4flags","subaddress"];
 if header :contains "X-Spam-Flag" "YES"
 {
  fileinto "Junk";
@@ -14,3 +14,9 @@
  fileinto "INBOX/pattern";
  stop;
 }
+# rule:[dmarc]
[...]

The require ‘array’ was completely rewritten… I’ll look at Roundcube documentation if this an expected behaviour.

Regards,


Ludovic