Global sieve variables don't work in 2.4.4
12 Aug
2026
12 Aug
'26
12:54 p.m.
Hi everyone!
I have created a minimal reproducible setup. First, let's prepare the environment and create the necessary directories:
getent group vmail >/dev/null \
|| groupadd -g 500 vmail; \
getent passwd vmail \
| awk -F: '$3 == "500" && $4 == "vmail"' >/dev/null \
|| { id vmail >/dev/null 2>&1 && usermod -u 500 -g vmail vmail \
|| useradd -u 500 -g vmail -M -s /usr/sbin/nologin vmail; }
mkdir -p /mail && chown vmail:vmail -R /mail
cat > /mail/global_bug.sieve <<EOF
require ["variables", "include"];
global "global_var";
set "global_var" "hello";
EOF
cat > /mail/before_bug.sieve <<EOF
require ["variables", "include", "vnd.dovecot.debug"];
global "global_var";
include :global :optional "global_bug";
debug_log "\${global_var}";
EOF
Then, we configure dovecot.conf:
dovecot_config_version = 2.4.4
dovecot_storage_version = 2.4.4
auth_allow_cleartext = yes
mail_driver = maildir
mail_home = /mail/%{user}
mail_inbox_path = .INBOX
mail_uid = vmail
mail_gid = vmail
first_valid_uid = 500
protocols {
imap = yes
}
mail_plugins {
imap_sieve = yes
}
service imap-login {
inet_listener imaps {
port = 0
}
}
passdb anypass {
driver = static
fields {
nopassword = yes
}
}
sieve_global_extensions {
vnd.dovecot.debug = yes
}
sieve_script global_bug {
driver = file
path = /mail/global_bug.sieve
type = global
}
namespace inbox {
inbox = yes
separator = /
mailbox INBOX {
auto = subscribe
sieve_script before_bug {
driver = file
path = /mail/before_bug.sieve
cause = APPEND
type = before
}
}
}
If we run an APPEND command to the INBOX directory:
curl -v -u "user1:hello" -k "imap://localhost:143/INBOX" --upload-file /tmp/test.eml
the log shows an empty message.
imap(user1)<3155434><YNISPNZYHtV/AAAB>: sieve: DEBUG:
However, if we change the configuration and the Sieve script by replacing "global" with "personal", I see my hello in debug log:
...
sieve_script global_bug {
driver = file
path = /mail/global_bug.sieve
type = personal # !!!
}
...
require ["variables", "include", "vnd.dovecot.debug"];
global "global_var";
include :personal :optional "global_bug"; # !!!
debug_log "\${global_var}";
...
imap(user1)<3155659><iiiIhNZYgpl/AAAB>: sieve: DEBUG: hello
Why am I unable to import a global variable into a before script if it is defined in a global script?
Thank You in advance!
0
Age (days ago)
0
Last active (days ago)
0 comments
1 participants
participants (1)
-
inaugurator@ya.ru