I'm have a problem where dovecot-sieve is used to run the script after moving emails from Junk Folder.
config:
imapsieve_mailbox2_name = *
Imapsieve_mailbox2_from = INBOX.Junk
imapsieve_mailbox2_causes = COPY
imapsieve_mailbox2_before = file:/usr/local/lib/dovecot/sieve/report-ham.sieve
filter:
require [ "vnd.dovecot.pipe", "copy", "imapsieve", "environment", "variables", "fileinto", "envelope" ];
if environment :matches "imap.mailbox" "*" {
set "mailbox" "${1}";
}
if string "${mailbox}" "INBOX.Trash" {
stop;
}
if environment :matches "imap.user" "*" {
set "username" "${1}";
}
pipe :copy "sa-learn-ham.sh" [ "${username}" ]
It's working perfectly.
However, I have a problem after adding :
if envelope :is "from" "*" {
set :lower "from" "${1}";
}
pipe :copy "sa-learn-ham.sh" [ "${username}", "${from}" ]
then appears error in log file:
Error: sieve: report-ham: line 1: the envelope extension cannot be used in this context (needs access to message envelope)
Is possible to use envelope extension to get sender address after moving message from Junk folder ?
Regards,
Jack