For other people ho are havingthe same issues.
allredeay resolved it. the script is also removing the decrypted files. so i removed the last of the script.
find /var/vmail/domain_name/user/ -type f -regextype egrep -regex ‘.S=.W=.*’ | while read -r file; do
if [[ $(head -c7 “$file”) == “CRYPTED” ]]; then
doveadm fs get compress lz4:0:crypt:private_key_path=/mail_crypt/ecprivkey.pem:public_key_path=/mail_crypt/ecpubkey.pem:posix:prefix=/ \
“$file” > “/tmp/$(basename ”$file")"
if [[ -s “/tmp/$(basename ”$file")" ]]; then
chmod 600 “/tmp/$(basename ”$file")"
chown 5000:5000 “/tmp/$(basename ”$file")"
mv “/tmp/$(basename ”$file")“ ”$file"
else
rm “/tmp/$(basename ”$file")"
fi
fi
done
to
find /var/vmail/domain_name/user/ -type f -regextype egrep -regex ‘.S=.W=.*’ | while read -r file; do
if [[ $(head -c7 “$file”) == “CRYPTED” ]]; then
doveadm fs get compress lz4:4:crypt:private_key_path=/mail_crypt/ecprivkey.pem:public_key_path=/mail_crypt/ecpubkey.pem:posix:prefix=/ \
“$file” > “/tmp/$(basename ”$file")"
if [[ -s “/tmp/$(basename ”$file")" ]]; then
chmod 600 “/tmp/$(basename ”$file")"
chown 5000:5000 “/tmp/$(basename ”$file")"
fi
fi
done