Well, this has gotten way over my head very quickly!
FWIW, here is the complete section 4, with personal stuff (if I caught it all...), munged. There are two custom rules set up (though I have a huge Sieve code as well, but that executes after section 4 rules, no?) The second custom rule works fine, with no retention of emails in the Inbox. Just the first rule has that occur.
Code:
### 4. User configured rules
### 4a. Calculate rule actions
# Search: "to:vita_r-not-filing@myaddress.com subject:(GetYourRefund Client)"
if
allof( not string :is "${stop}" "Y",
jmapquery text:
{
"conditions" : [
{
"conditions" : [
{
"to" : "vita_r-not-filing@myaddress.com"
},
{
"cc" : "vita_r-not-filing@myaddress.com"
},
{
"bcc" : "vita_r-not-filing@myaddress.com"
},
{
"deliveredTo" : "vita_r-not-filing@myaddress.com"
}
],
"operator" : "OR"
},
{
"conditions" : [
{
"subject" : "GetYourRefund"
},
{
"subject" : "Client"
}
],
"operator" : "AND"
}
],
"operator" : "AND"
}
.
)
{
set "read" "Y";
if mailboxidexists "655686524b36ba99" {
set "L0_archives_to_delete_permenently" "Y";
set "skipinbox" "Y";
}
set "stop" "Y";
}
# Search: "from:michelec@anotheraddress.org"
if
allof( not string :is "${stop}" "Y",
jmapquery text:
{
"from" : "michelec@anotheraddress.org"
}
.
)
{
set "read" "Y";
if mailboxidexists "c5c83b43-921a-4a80-8324-e36b774e6b68" {
set "L1_Dads_mail_VITA_RAC_Volunteer_Hours" "Y";
set "skipinbox" "Y";
}
set "stop" "Y";
}
### 4b. Rule sent message to trash
if anyof(
string :is "${deletetotrash}" "Y",
string :is "${spam}" "Y"
) {
set "skipinbox" "Y";
}
# Copies always get marked read for better compatibility with IMAP clients
# and labels mode.
if anyof(
string :is "${read}" "Y",
not string :is "${skipinbox}" "Y"
) {
if hasflag "\\Seen" {
set "read" "Y";
} else {
addflag "\\Seen";
}
}
# Similarly, only the inbox copy gets flagged
if allof(
string :is "${flagged}" "Y",
string :is "${skipinbox}" "Y"
) {
addflag "\\Flagged";
}
if string :is "${deletetotrash}" "Y" {
fileinto :specialuse "\\Trash" "INBOX.Trash";
}
### 4c. Rule says message is spam
elsif string :is "${spam}" "Y" {
fileinto :specialuse "\\Junk" "INBOX.Junk Mail";
}
### 4d. Do rule actions
else {
if string :is "${L0_archives_to_delete_permenently}" "Y" {
fileinto
:copy
:mailboxid "655686524b36ba99"
"INBOX.archives.to delete permenently";
set "hasmailbox" "Y";
}
if string :is "${L1_Dads_mail_VITA_RAC_Volunteer_Hours}" "Y" {
fileinto
:copy
:mailboxid "c5c83b43-921a-4a80-8324-e36b774e6b68"
"INBOX.Dads mail.VITA.RAC Volunteer Hours";
set "hasmailbox" "Y";
}
# Then archive or clear implicit keep if skipping inbox
if string :is "${skipinbox}" "Y" {
if not string :is "${hasmailbox}" "Y" {
fileinto
:mailboxid "8fb0a692-ab78-4e62-a475-7f7fe05c14c9"
:specialuse "\\Archive"
"INBOX.Archive";
} else {
discard;
}
} else {
# Set flags for inbox copy
if not string :is "${read}" "Y" {
removeflag "\\Seen";
}
if string :is "${flagged}" "Y" {
addflag "\\Flagged";
}
# Do MailFetch filing if applicable, otherwise deliver to inbox
}