Hi,
The ability of `sieve` to use variables is really nice. Two things I don't
think you can do (but would be nice) are:
1. Test if a variable exists
2. Set a variable in a block (or maybe iterate a variable).
In my search to come up with a rule that backs up all email, I thought I could
do with the 'pipe' extension. For various reasons I wanted to run the rule
'once' (as I'm rsync'ing the folder) not on every single email. The "obvious"
way seemed to be to have a counter variable, so something like:
if counter-variable
# don't rsync as it's already been done this session
keep;
else
do backup
set counter-variable
I couldn't figure out how to check a variable, all the options seem to be
related to the message. Here's what I tried:
if envelope :matches "to" "${sender}"
{
keep;
}
else
{
set "backup_folder" "/home/steve/.mail/test-account";
set "sender" "[email protected]";
pipe "/home/steve/bin/sieve-backup-all-mail.sh ${backup_folder}/INBOX
${backup_folder}/all-mail/";
keep;
}
The manual's example says that variables are checked against the message using
:matches. I couldn't figure out a way to set a `counter` variable and then just
check if it existed, or the contents of it (like "if did-backup-already == 1").
As you can see I tried to use :matches and then something that would match
every time. This didn't work, and I think it's because I'm creating the
"sender" variable inside the block. It doesn't appear to then exist outside the
block?
Anyway, just some thoughts,
Steve