[imp] Sieve app gets made more usable...
Mike Cochrane
mike@graftonhall.co.nz
Tue, 27 Aug 2002 21:01:39 +1200
Quoting Didi Rieder <adrieder@sbox.tugraz.at>:
> Hi Mike,
>
> great work, I have a short question:
>
> Could you also provide the possibility to forward all mails via sieve to
> another email address?
>
> Didi
There are a few tricky issues with regards to the implicit keeps in scripts.
A redirect causes the implict keep to not happen, which is fine if you only want
your email redirected. A 'keep' action could be added after it which would
deliver all the message into your INBOX also which would be fine except it
messes with the actions of the rules below it. If the redirection is at the end
then a stop action in a script would cause the script to end before it go to the
redirect and the mail wouldn't get redirected.
The problem is trying to structure a script in such a way that the redirection
doesn't affect other rules.
A simple redirect all mail is easy, the hard part is allowing it to continue
though the other rules without a problem. See the script below:
--- start of script ----
# email redirection here
redirect "someoneelse@example.com";
# option 1
# redirect
if header :comparator "i;ascii-casemap" :contains "To" "me@example.com" {
redirect "realme@example.com";
}
# redirect
if header :comparator "i;ascii-casemap" :contains "To" "otherme@example.com" {
fileinto "INBOX.otherme";
stop;
}
# option 2
--- end of script ---
this script redirects all mail to someoneelse@example.com
all email with me@example.com in the to header is redirected
all email with otherme@example.com in the to header is filed.
all other mail is not delivered anywhere locally.
If the keep action was put at option 1 then all mail would get delivered locally
meaning that mail to otherme@example.com would end up in both INBOX and
INBOX.otherme.
If the keep action was put at option 2 then mail redirected to
realme@exmaple.com still gets delivered into INBOX, where the implicit discard
previously didn't deliver it as expected.
If someone has, or can come up with, a nicely structured script that works
around these issues i'd be keen to see it.
- Mike :-)