Subject: Re: sieve vacation draft, really

From: Michael Salmon <[email-masked]>
Date: Tue, 23 Feb 1999 08:48:55 +0100

+----- On 22 Feb 1999 16:11:15 EST, Tim Showalter writes:
| > Date: Thu, 18 Feb 1999 13:42:22 +0100
| > From: Michael Salmon <[email-masked]>
| 
| I am sending this as a personal reply because the message I am replying
| to was not sent to the mailing list.  Please feel free to send the reply 
| to this to the mailing list, though.

Maybe I need an extension to sieve that can add reply-to for me ;^).

| > +----- On 17 Feb 1999 16:50:57 EST, Tim Showalter writes:
| > [...]
| > | > Presumably one can have more than vacation statement in a script and
| > | > if that is the case must all :days be the same? What happens if they
| > | > aren't? Should the respondent lists be independent?
| > | 
| > | What's the problem?
| > | 
| > | I don't have strong motivation for making multiple vacations in a single
| > | script act specially, although I believe that a given script should only
| > | send out a vacation message once.
| > 
| > I agree that only one message should be sent but the text may vary 
| > depending upon the address I received the message as and who sent the 
| > message.
| 
| Ok, what do I need to change in the text to make this work?  I assumed
| this was obvious.

That one can have multiple vacations is at least not forbidden but what 
I am interested in is how :days is handled. If I send a message to you 
with :days 7 and after 6 days you trigger another vacation with 
a :days of 5 which applies. 

That was what I saw as a problem but the behaviour probably doesn't 
need to be defined.

| > | > I also feel that it should be possible to clear the respondent lists
| > | > so that new messages are distibuted.
| > | 
| > | I oppose this on two grounds: first, how does one clear the respondant
| > | lists?  Such things are very implementation dependant, and I'd rather
| > | just not discuss them.  Second, Those features are in vacation for
| > | safety reasons; earlier drafts had a command that did not have them
| > | called "reply" that were removed for these reasons.
| > 
| > I agree that it could be hard to define but vacation clears respondent 
| > list (vacation.{pag,dir}) whenever the message is edited, it was that 
| > functionality that I wanted.
| 
| I don't know that I can guarantee a way of doing that.  Modtimes are
| availible in all the cases I can think of, but I'm not sure what to do
| here.
| 
| I can think of a good way of implementing it though that is robust and
| not real hard, so we could do this, if you'll discuss it on the mailing
| list.  I'm a little worried about people changing the messages too
| often, though.

One think that I thought of was that if I can edit the sieve script 
then I am not on vacation anymore or I am about to start another and 
that the list should be cleared. What I would like is for every 
vacation statement to have a list of it's own based on the message, 
when a particular message disappears it's list disappears, the creation 
and destruction of recipient lists is handled as part of the checking 
of the script. I think that that is too hard to implement but that 
doesn't make it undesirable.

/Michael

---

From: Tim Showalter <[email-masked]>
Date: 23 Feb 1999 14:08:38 -0500

> Date: Tue, 23 Feb 1999 08:48:55 +0100
> From: Michael Salmon <[email-masked]>

> a :days of 5 which applies. 

So you want two vacation messages per address?  That worries me a little 
bit.  Does this make anyone else nervous?  (If the answer is no, I have
no problem with it.)

I will try and fix the vacation text to make it clear that multiple
vacations are permitted.

> doesn't make it undesirable.

The implementation of this stuff isn't real hard in any case; it's far
more difficult to write the parts of the code that actually do the
reply, as far as I can tell.

If you're *deleting* vacation actions, there's no problem (because all
you can do is delete the vacation actions anyway).  If you go on
vacation, come back, then go on vacation again, that's different,
because you might not send the new message to me.

I have no strong feelings on the matter.

-- 
Tim Showalter <[email-masked]>

---

From: Michael Salmon <[email-masked]>
Date: Thu, 25 Feb 1999 13:07:36 +0100

+----- On 23 Feb 1999 14:08:38 EST, Tim Showalter writes:
[...]
| So you want two vacation messages per address?  That worries me a little 
| bit.  Does this make anyone else nervous?  (If the answer is no, I have
| no problem with it.)
| 
| I will try and fix the vacation text to make it clear that multiple
| vacations are permitted.

I seem to be having trouble explaining myself and I guess that that 
means that it isn't important but I'll give it one more try, here is 
what I mean

if work_related {
	vacation :days 7 "Contact Joe if it is serious, back on 23/7"
}
if from_my_friends {
	vacation :days 14 "Rebuilding the patio until 23/7, call me at home"
}

I would guess that most applications would store the time of the last 
message which is the behavior that I want but it could store the date 
of the next message which I think is wrong but both are allowed.

/Michael

---

From: "Alan K. Stebbens" <[email-masked]>
Date: Fri, 26 Feb 1999 16:06:52 -0800

| > One think that I thought of was that if I can edit the sieve script
| > then I am not on vacation anymore or I am about to start another and
| > that the list should be cleared. What I would like is for every
| > vacation statement to have a list of it's own based on the message

I agree.  Each vacation statement should have its own cache of reply
timestamps.

Some other issues related to vacation:

>From reading the Sieve Vacation spec, it isn't clear to me if vacation
generates relies to the common system manager, root, mailer-daemon, and
other well-known addresses.  Even if there is code in the implementation to
avoid auto-replies to mail from computer entities, there should be a way to
modify this list of addresses to which auto-responses should be avoided.

I do not think that this list should be specified as an argument to the
vacation action.  The list is too long, and remains fairly constant over
time.  It only periodically needs to be changed.  To me, this speaks to the
need of a variable that can be set by the user somewhere and referenced by
the vacation action.  For example, if there were an intrisic variable called
"MAILER_LIST", then the vacation should be implemented to avoid
auto-responding to the MAILER_LIST.

Similarly, it should be possible to allow the user to decide if vacation
should respond to addresses on the "To" header alone, or on both the "To"
and "Cc" headers.  For example, in my current procmail recipes, my vacation
response occurs only to "To" header mail.

Further, if the message is either a bulk mail, or is itself an auto-response
from some other program, then it probably doesn't make much sense to
auto-respond to it.

Of course, it is possible to write a complicated Sieve rule to detect these
cases, but then this ruleset will have to written throughout all of
Sieve-land, whereever it is used.  If the proper use of vacation requires
the observance of these various factors, then the implementation of vacation
ought to provide for these rules in the first place.

I've spent a considerable amount of time implementing a procmail recipe
("ackmail.rc") that is flexible yet careful about not responding
unecessarily.  The rules that govern its behaviour are:

1. Is it addressed to me (using any of my addresses)?
2. Is the mail NOT from any kind of system or mailer daemon?
3. Is the mail NOT from a mailing list or bulk mail?
5. Does the subject NOT have any text indicating some kind of automatic
   reply mechanism has already taken place?
6. Is this NOT a message we generated (a bounce, maybe)?
7. Is the message NOT from anyone on our "noack" list?
8. Is it from an address that is NOT already in our acknowledgement cache?
In my implementation, addresses in the cache have corresponding timestamps
which cause them to expire, allowing subsequent auto-responses.

If vacation doesn't observe these rules, then it will generate an unecessary
auto-response to either a program (which won't understand it, and will
likely auto-respond itself), or to a person who won't appreciate it.

I don't mean to make this vacation action more complicated than it is, but
it *is* complicated if you wish to make it useful without also inducing
anguish.

If you are familiar with procmail recipes, and wish to see the
vacation/auto-ack recipe file, send me a message with the subject "send
procmail library", and examine the "ackmail.rc" file.

--
Alan K. Stebbens <[email-masked]>
Software.com, 525 Anacapa St., Santa Barbara, CA 93101
Work: 805.882.0579 Fax: 805.957.1544

Reply-To: <[email-masked]>
From: "Alan K. Stebbens" <[email-masked]>
To: "Tim Showalter" <[email-masked]>
Cc: <[email-masked]>
Subject: RE: sieve vacation draft, really 
Date: Fri, 26 Feb 1999 16:06:52 -0800
Importance: Normal
Sender: [email-masked]

| > One think that I thought of was that if I can edit the sieve script
| > then I am not on vacation anymore or I am about to start another and
| > that the list should be cleared. What I would like is for every
| > vacation statement to have a list of it's own based on the message

I agree.  Each vacation statement should have its own cache of reply
timestamps.

Some other issues related to vacation:

>From reading the Sieve Vacation spec, it isn't clear to me if vacation
generates relies to the common system manager, root, mailer-daemon, and
other well-known addresses.  Even if there is code in the implementation to
avoid auto-replies to mail from computer entities, there should be a way to
modify this list of addresses to which auto-responses should be avoided.

I do not think that this list should be specified as an argument to the
vacation action.  The list is too long, and remains fairly constant over
time.  It only periodically needs to be changed.  To me, this speaks to the
need of a variable that can be set by the user somewhere and referenced by
the vacation action.  For example, if there were an intrisic variable called
"MAILER_LIST", then the vacation should be implemented to avoid
auto-responding to the MAILER_LIST.

Similarly, it should be possible to allow the user to decide if vacation
should respond to addresses on the "To" header alone, or on both the "To"
and "Cc" headers.  For example, in my current procmail recipes, my vacation
response occurs only to "To" header mail.

Further, if the message is either a bulk mail, or is itself an auto-response
from some other program, then it probably doesn't make much sense to
auto-respond to it.

Of course, it is possible to write a complicated Sieve rule to detect these
cases, but then this ruleset will have to written throughout all of
Sieve-land, whereever it is used.  If the proper use of vacation requires
the observance of these various factors, then the implementation of vacation
ought to provide for these rules in the first place.

I've spent a considerable amount of time implementing a procmail recipe
("ackmail.rc") that is flexible yet careful about not responding
unecessarily.  The rules that govern its behaviour are:

1. Is it addressed to me (using any of my addresses)?
2. Is the mail NOT from any kind of system or mailer daemon?
3. Is the mail NOT from a mailing list or bulk mail?
5. Does the subject NOT have any text indicating some kind of automatic
   reply mechanism has already taken place?
6. Is this NOT a message we generated (a bounce, maybe)?
7. Is the message NOT from anyone on our "noack" list?
8. Is it from an address that is NOT already in our acknowledgement cache?
In my implementation, addresses in the cache have corresponding timestamps
which cause them to expire, allowing subsequent auto-responses.

If vacation doesn't observe these rules, then it will generate an unecessary
auto-response to either a program (which won't understand it, and will
likely auto-respond itself), or to a person who won't appreciate it.

I don't mean to make this vacation action more complicated than it is, but
it *is* complicated if you wish to make it useful without also inducing
anguish.

If you are familiar with procmail recipes, and wish to see the
vacation/auto-ack recipe file, send me a message with the subject "send
procmail library", and examine the "ackmail.rc" file.

--
Alan K. Stebbens <[email-masked]>
Software.com, 525 Anacapa St., Santa Barbara, CA 93101
Work: 805.882.0579 Fax: 805.957.1544

To: [email-masked]
Subject: Re: sieve vacation draft, really 
Date: Thu, 25 Feb 1999 13:07:36 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

if work_related {

/Michael

Date: 24 Feb 1999 15:52:29 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

> Date: Wed, 24 Feb 1999 19:49:46 GMT
> From: Adam Back <[email-masked]>
> CC: [email-masked], [email-masked]
> 
> Tim writes:
> > So I think hashcash is an interesting idea with some technichal merit,
> > and I'd like to help hammer out the bugs.  I'd be happy to write or help
> > write a hashcash test for Sieve, although there are some bugs to work
> > out.
> > 
> > That said, if Adam is willing, perhaps we should hit up Paul for yet
> > another IMC mailing list.
> 
> Which ever is most productive way to go.  It depends how much work is
> involved in hammering out details of hashcash, which in turn depends
> on how generic it is made.

I've sent mail out to Paul Hoffman asking for a mailing list to be created.

Tim

Date: Wed, 24 Feb 1999 19:47:25 GMT
From: Adam Back <[email-masked]>
To: [email-masked]
CC: [email-masked], [email-masked], [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

Dave Kristol wrote:
> Adam Back wrote:
> 
> > As started to come out in my response to Tim Showalter there is some
> > complexity once you start to think seriously about using hashcash:
> > 
> > - mailing lists
> > 
> >   need a way to by pass postage requirement for list software
> 
> Unfortunately, mailing lists are hard.  

To be clear, I meant that the list software (eg. majordomo) would be
exempt from including postage for each list subscriber that it will
forward list traffic to.

You could require postage to post to the list, where the list software
could reject posts without sufficient postage.

> You want to by-pass the postage requirement, but only if the sender
> is a legitmate sender.  (And how do you define that?)  How many
> lists have you been on where a spammer sent junk to it?

Sure it happens.  The most sensible solution I have seen for this
problem is moderation, third party filtered versions of lists, and
distributed ratings / filtering using NoCeM.  (NoCeMs can be used for
mailing lists as well as USENET news, and allow any number of people
to submit article ratings that NoCeM aware clients can use).

> Also, how do you deal with just lists of recipients (as in the Cc line
> of this message?)  Do you attach coins for each recipient?

Well there are at least two things that you could do:

- attach a coin for each recipient (as you suggest)

- send a combined coin (a collision computed over the concatenation of
the recipients)

The first approach could leak the identity of a Bcc if you included
the postage in all copies.

The second approach does not work so well if there are also some
Bcc's.

I think the first approach could work, if you sent the postage in the
email address using the +extension.  eg. for this message:

without hashcash:

To: [email-masked]
CC: [email-masked], [email-masked], [email-masked]

with hashcash:

To: [email-masked]
Cc: [email-masked],
	ietf-mta-filters+10646-b3f5a8831b726fef,
	[email-masked]

(The above are real 20 bit collisions, taking average 8 seconds each
to produce on AMD k6-2/300Mhz linux box.)

using the transform of X@Y -> X+date-cash@Y

The software at http://www.dcs.ex.ac.uk/~aba/hashcash/ creates
hashcash with slightly different form to those I used above.  It
produces:

% hashcash -20 [email-masked]
speed: 126758 hashes per sec
find: 20 bit partial sha1 collision
estimate: 8 seconds
expected: 1048576 tries = 2 ^ 20 tries
collision: [email-masked]
tries: 952419 0.91 x expected
time: 8 seconds

so it's hashcash is of form:

[email-masked]

because it tries to require no other state -- the string the collision
is on is included in the cash.  The alternate format I used above must
be formatted differently because the result must be a valid and
deliverable RFC822 mail address.

Adam

Date: Wed, 24 Feb 1999 19:49:46 GMT
From: Adam Back <[email-masked]>
To: [email-masked]
CC: [email-masked], [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

Tim writes:
> So I think hashcash is an interesting idea with some technichal merit,
> and I'd like to help hammer out the bugs.  I'd be happy to write or help
> write a hashcash test for Sieve, although there are some bugs to work
> out.
> 
> That said, if Adam is willing, perhaps we should hit up Paul for yet
> another IMC mailing list.

Which ever is most productive way to go.  It depends how much work is
involved in hammering out details of hashcash, which in turn depends
on how generic it is made.

If you want to play with software, and try something with sieve, take
the hashcash implementation at http://www.dcs.ex.ac.uk/~aba/hashcash/

It includes an (inefficient) double spend database, collision
generator, and collision checker as a command line util complete with
useful exit codes.

Adam

Date: Wed, 24 Feb 1999 11:48:37 -0500
From: Dave Kristol <[email-masked]>
To: Adam Back <[email-masked]>
CC: [email-masked], [email-masked], [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

Adam Back wrote:

> As started to come out in my response to Tim Showalter there is some
> complexity once you start to think seriously about using hashcash:
> 
> - mailing lists
> 
>   need a way to by pass postage requirement for list software

Unfortunately, mailing lists are hard.  You want to by-pass the postage
requirement, but only if the sender is a legitmate sender.  (And how do
you define that?)  How many lists have you been on where a spammer sent
junk to it?

Also, how do you deal with just lists of recipients (as in the Cc line
of this message?)  Do you attach coins for each recipient?

Dave Kristol

Date: 24 Feb 1999 11:49:48 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked], Adam Back <[email-masked]>
Cc: [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

So I think hashcash is an interesting idea with some technichal merit,
and I'd like to help hammer out the bugs.  I'd be happy to write or help
write a hashcash test for Sieve, although there are some bugs to work
out.

That said, if Adam is willing, perhaps we should hit up Paul for yet
another IMC mailing list.

Tim

Date: 24 Feb 1999 11:43:00 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked], Gregory Sereda <[email-masked]>
Subject: Re: yet more changes to Sieve
Sender: [email-masked]

> Date: Wed, 24 Feb 1999 09:59:11 -0500
> From: Gregory Sereda <[email-masked]>
> 
> At 03:16 AM 2/24/99 -0500, Tim Showalter wrote:
> >(2.4.2.3) Address comparasons are defined to be case-insensitive on the local
> >part.  (Gregory Sereda has suggested this, and it seems like a very good
> >idea.)
> 
> I think that I suggested making the comparason case-insensitive on the
> domain part (not local part).

Right, that should have been domain-part.  Hopefully that was the most
serious mistake I made.

Date: Wed, 24 Feb 1999 16:13:12 GMT
From: Adam Back <[email-masked]>
To: [email-masked]
CC: [email-masked], [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

Matthew Wall writes:
> To which Matthew Wall offers this response on Mon, 22 Feb 1999 19:06:17
> -0500:
> >
> >
> >This would seem to me to be a trivial (and worthwhile) extension, but not
> >something that belongs in the base spec. 
> >
> Any other comments?
> 
> Adam, will you be at the Minneapolis IETF?

Unfortunately not, no.  Further feed back and discussion of the merit
of forming a technical anti-spam group under IETF requested!

As started to come out in my response to Tim Showalter there is some
complexity once you start to think seriously about using hashcash:

- mailing lists

  need a way to by pass postage requirement for list software

- forwarding

  need to be able to forward messages to your other email address
  without needing to pay yourself hashcash

- possibility for ecash (with real $ value) as postage

- privacy

  need to retain privacy if ISP side allow lists are maintained

I think that technical means to deal with UBE are important because
without them we get calls for all manner of anti-UBE laws which
encourage excessive involvment and intrusion of the legal systems into
email and the internet.  In my view laws rarely make anything better.

Adam

Date: Wed, 24 Feb 1999 16:05:50 GMT
From: Adam Back <[email-masked]>
To: [email-masked]
CC: [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

> > I am requesting comments from this group because it seems the closest
> > match of IETF topic to "technical solutions to UBE".  I am open to
> > comments as to how best to progress this technical solution.
> 
> We are not trying to solve the spam problem.  That said, I like
> hashcash.  Adding a test for a hashcash value is trivial.  But getting
> Sieve out there is a large amount of work in itself.

Possibly a technical anti-spam group could be formed.  One of my
reasons for posting the request for comments was to get feed back on
the question of where hashcash should be progressed.

> > The originator is required to send with email a costly to compute
> > token bound to that resource name.  Example: Coyote emails Roadrunner,
> > he computes a hash collision on "[email-masked]".  birdseed.org
> > runs a MTA filter rejecting mail without hashcash postage.
> 
> The problem with this is that it means the amount of computational power 
> that a mailing list costs is rather high.

You need some kind of free-reply tokens (say by subcribing to the
mailing list using an email address of special form), or allow list of
email addresses not requiring hashcash to get around problems like
this.

Adam

Date: Wed, 24 Feb 1999 09:59:11 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: yet more changes to Sieve
Sender: [email-masked]

At 03:16 AM 2/24/99 -0500, Tim Showalter wrote:
>(2.4.2.3) Address comparasons are defined to be case-insensitive on the local
>part.  (Gregory Sereda has suggested this, and it seems like a very good
>idea.)

I think that I suggested making the comparason case-insensitive on the
domain part (not local part).  The COMPARATOR argument defines the
comparason for the local part (which defaults to "i:ascii-casemap").
For internet mail addresses, the COMPARATOR type of "i;octet" should
be used if the system supports case-sensitive "localpart", ie mailbox.

This should allow scripts to distinguish between addresses like:

        [email-masked], [email-masked]

while treating the following addresses as the same:

        [email-masked], [email-masked]

Greg Sereda 

Date: 24 Feb 1999 03:16:17 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: yet more changes to Sieve
Sender: [email-masked]

This is a list of places where in my most recent review of the Sieve
spec, I found problems.  I'd like to make these changes; I may not make
them by Friday.

I hope I'm not starting to cover old ground here; some of the error
discussion feels that way to me, but I believe it's important for
interoperability.

(2.4.2.3) Address comparasons are defined to be case-insensitive on the local
part.  (Gregory Sereda has suggested this, and it seems like a very good
idea.)

(2.4.2) Backslashes always disable magic semantics of a character, even if it
has none.  This prohibits backslashes to make characters magic.  This is no
real change to the existing specs but may change extensions.  This is what
CMU's implementation implements (because it doesn't matter now and it was
easier).

(2.10.4) This section is meant to provide limits on some actions.  I propose
the removal of redundant text in the Security Considerations section (to be
replaced with a reference to this section), along text implying the following:

Sites get to establish limits on numbers of actions.  If users go over the
limits, it is not an error, and the actions listed in the script first count.
Zero is not an allowed limit.

The maximum number of rejects that a script is allowed to perform on a single
message is one.

(Following from this, the maximum number of vacations to be excuted by a
single script running on a single message is one.)

There is probably need for more text here.

(2.10.6, new section) We need some discussion of error handling to at least
define what "error" means in the draft.  I know some of this was chalked 
up as quality-of-implementation issues, but we haven't laid down ground
rules for bare minimums.  I suggest the following text.

	For the purposes of this memo, there are two kinds of errors,
	compile-time and run-time.

	Run-time errors arise when an implementation actually tries to run an
	action: the user is over quota, too many of a given action are taken,
	too many actions are taken on a single message, etc.

	Compile-time errors are those that are detected during parsing.  The
	label "compile-time" is descriptive, but inaccurate, as most
	implementations are not expected to actually compile scripts to
	machine or byte code.

	While implementations are certainly allowed to perform atomic
	operations such that in the case of a run-time error, no actions
	are taken, they are not required to do so.  It is expected that
	in the case of run-time errors, implementations may have partial 
	failures.

	Implementations are permitted to detect compile-time errors until they 
	actually encounter a syntax error or an unrecognized require.
	Implementations may execute actions while evaluating the script.
	However, in the event of an error, implementations MUST abort out at
	the first oppertunity.

	In the case of any error, the equivalent of a "keep" action
	happens to ensure that the message is delivered to someone.

	The above is very permissive.  Implementations are encouraged to
	detect errors as early as possible and inform users that something has
	gone wrong.  It is better to do a full parse before executing the
	script, but it is not required.

Date: 23 Feb 1999 14:08:38 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Cc: Michael Salmon <[email-masked]>
Subject: Re: sieve vacation draft, really 
Sender: [email-masked]

Date: 23 Feb 1999 14:00:57 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked], Gregory Sereda <[email-masked]>
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

> Date: Mon, 22 Feb 1999 17:21:35 -0500
> From: Gregory Sereda <[email-masked]>
> 
> At 05:02 PM 2/22/99 -0500, Tim Showalter wrote:
> >I don't see a good reason that COMPARATOR can't apply to the whole
> >address, it's just useless on the right-side.  Right?
> 
> If we canonicalize the domain-part to (say) lower case, then we have
> effectively defined the domain-part comparator as "i:ascii-casemap".
> That is why I say the COMPARATOR applies only to the localpart.
> I thought I was saying the same thing you were saying.

I'm not sure about this.  I'm pretty sure I'm missing something.  I
don't think the two things are identical in any case.

> Actually, I like stating that domain part of address will always 
> use the comparator "i;ascii-casemap".  Because if you only
> canonoicalize the message (and not the script), the following
> will always be false:
> 
> 	if address :is :all "from" "[email-masked]" {
> 		discard;
> 	}
> 
> If you canonicalize both the message and script domain parts to
> lowercase, you are doing an "i;ascii-casemap" compare regardless
> of what COMPARATOR you have specified.  Right?

The problem is that in a script like

	if address :all :contains "from" "andrew"

both [email-masked] and [email-masked] match.

I think that at this point I agree with you; comaprator for address and
header works against only the local-part and not the domain-part, and
i;ascii-casemap just happens to be the default (I don't want to make
this a special case, and I doubt that anyone else does, either).  I
don't think it's that much harder to write, but I could be wrong.

If we do this, everything I said about canonicalizing the domain-part to 
(say) lower-case is useless.

Tim

To: Tim Showalter <[email-masked]>
Cc: [email-masked]
Subject: Re: sieve vacation draft, really 
Date: Tue, 23 Feb 1999 08:48:55 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

/Michael

To: Tim Showalter <[email-masked]>
Cc: [email-masked]
Subject: Re: Support for the vacation extension 
Date: Tue, 23 Feb 1999 08:26:13 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

+----- On 22 Feb 1999 16:07:25 EST, Tim Showalter writes:
| Shouldn't this have been sent to the mailing list?

Yes, I haven't yet got into the habit of changing the address when I 
reply.

| I am willing to agree to your changes if you can get someone who knows
| more about i18n than I do other than yourself (i.e., anyone) to agree to 
| them.  I see the argument, and I realize that not having this ability
| will be inconvienent for the large number of users who aren't using
| UTF-8 in their mailers.
| 
| I don't think it's *that* difficult for the European languages, so I
| don't see a big issue to convert the UTF-8 in the script to 8859-1[5].

   The consensus seems to be that since microsoft has unicode support
there is no need to consider anything other than utf-8 which
coincidently means support for ASCII. It's one of the advantages of a
homogeneous computing environment I guess. My personal opinion is that
one should probably remove support for 8859-1 rather than have it alone.

/Michael

Date: Mon, 22 Feb 1999 19:07:42 -0500
From: Matthew Wall <[email-masked]>
To: [email-masked]
cc: Tim Showalter <[email-masked]>, Adam Back <[email-masked]>
Subject: Re: comments? hashcash based MTA filtering
Originator-Info: login-id=wall; server=imap.cyrusoft.com
Sender: [email-masked]

--On Mon, Feb 22, 1999 3:46 PM -0500 the entity known as Tim Showalter
<[email-masked]> wrote:

>   Adding a test for a hashcash value is trivial.  But getting
> Sieve out there is a large amount of work in itself.

To which Matthew Wall offers this response on Mon, 22 Feb 1999 19:06:17
-0500:

This would seem to me to be a trivial (and worthwhile) extension, but not
something that belongs in the base spec. 

Any other comments?

Adam, will you be at the Minneapolis IETF?

- matt

Date: Mon, 22 Feb 1999 19:05:27 -0500
From: Matthew Wall <[email-masked]>
To: [email-masked]
cc: Keith Moore <[email-masked]>, =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <[email-masked]>, Ned Freed <[email-masked]>, Tim Showalter <[email-masked]>, Sieve Mailing List <[email-masked]>
Subject: BOF Request, Minneapolis
Originator-Info: login-id=wall; server=imap.cyrusoft.com
Sender: [email-masked]

We (Ned Freed and myself, on behalf of the mta-filters mailing list) would
like to formally request a BOF for Minneapolis for Sieve (MTA-Filters).

We'd prefer 1.5 hours, would settle for 1 or 2. 2.5 hours is decidedly
excessive.

No conflicts with: DRUMS, any IMAP-related or mail-related items, and
directory services-related areas, CALSCHED, and WEBDAV.

Prefer no conflicts with: any APPS area meeting, anything related to
telephony or voicemail.

Please note this will be the SECOND BOF on this topic. We have cleared this
with our area directors.

The acronym we have used in the past is 

SIEVE

which stands for "Sieve", but is shorthand for a standardized mail
filtering language.

Formal agenda with references, etc. follows.

-------

References:

  Information/overview: 

     http://www.cyrusoft.com/sieve/

  Drafts:

     http://search.ietf.org/internet-drafts/draft-showalter-sieve-06.txt

       (Base spec)

http://search.ietf.org/internet-drafts/draft-showalter-sieve-vacation-00.txt
http://search.ietf.org/internet-drafts/draft-melnikov-sieve-imapflags-00.txt

(extensions)
 
Mailing List/Archives

Internet drafts on Sieve are discussed on the MTA Filters mailing list at
[email-masked]. (Note the name of the list does not imply Sieve
is an MTA-only filtering solution; the name is slightly anachronistic.)

Subscription requests can be sent to [email-masked] (send
an email message with the word "subscribe" in the body).

More information on the mailing list along with a WWW archive of back
messages is available at http://www.imc.org/ietf-mta-filters.

Formal agenda for Minneapolis IETF:

Overview

Sieve is a proposed standard language for filtering RFC822[bis] messages at
time of final delivery. The basic concept for Sieve was discussed as part
of the Internet Mail architecture within the IETF as early as 1995, and a
formal first BOF was held at the 41st IETF in March, 1998. At the time,
there was strong consensus for standardization along the basic proposed
structure of Sieve, but a mix of consensus about extended functionality and
the basic syntax.

At this time, the participants of the mta-filters mailing list believe that
the base document is ready to move to Proposed Standard upon the resolution
of a number of minor issues. There are multiple implementations, and most
suggestions of extension of scope made at the 41st IETF BOF have not
re-appeared on the mailing list. The primary purpose of the meeting will be
to resolve these issues, update the community at large, and if there are
issues that preclude Sieve from proceeding along Standards-track as is, to
discuss a charter for a working group or other disposition of the work
within the standards track.

Agenda

Overview/Status/Agenda check -- Matt Wall -- 10 minutes
--
Review of Current Syntax -- Tim Showalter -- 15 minutes
Open Issues on draft -- Tim Showalter and Ned Freed -- 45 minutes
(reference, draft-showalter-sieve-06.txt)
  -- Multiple fileinto syntax issue
  -- review of reject/keep discussions
  -- minor syntax issues
--
Vacation in base spec or as extension? -- 5 minutes
--
Working Group -- necessary or not at this point? -- Matt and Ned (15
minutes)

A proposed charter will be posted on the mailing list prior to the meeting,
and mirrored on the web site. However, the idea at this point is that a
formal working group is simply not necessary, and this will be prepared as
a "Plan B" in order to continue work under the aegis of the IETF / Apps
area in the event this second BOF does not suffice to bring things to
closure, the work is not laid aside, and further meetings may be required.

The scope of the charter will be limited to completion of the so-called
"base" Sieve grammar and functional requirements.

Date: Mon, 22 Feb 1999 17:21:35 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

At 05:02 PM 2/22/99 -0500, Tim Showalter wrote:
>I don't see a good reason that COMPARATOR can't apply to the whole
>address, it's just useless on the right-side.  Right?

If we canonicalize the domain-part to (say) lower case, then we have
effectively defined the domain-part comparator as "i:ascii-casemap".
That is why I say the COMPARATOR applies only to the localpart.
I thought I was saying the same thing you were saying.

Actually, I like stating that domain part of address will always 
use the comparator "i;ascii-casemap".  Because if you only
canonoicalize the message (and not the script), the following
will always be false:

	if address :is :all "from" "[email-masked]" {
		discard;
	}

If you canonicalize both the message and script domain parts to
lowercase, you are doing an "i;ascii-casemap" compare regardless
of what COMPARATOR you have specified.  Right?

Greg Sereda 

Date: 22 Feb 1999 17:02:41 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked], Gregory Sereda <[email-masked]>
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

> Date: Mon, 22 Feb 1999 16:59:54 -0500
> From: Gregory Sereda <[email-masked]>
> 
> At 04:50 PM 2/22/99 -0500, Tim Showalter wrote:
> >So what happens if we just canonicalize the domain-part to (say) lower
> >case for the purposes of header and envelope?  This is simple and should 
> >do the job reasonably well.
> 
> Sounds good to me.  The COMPARATOR argument would only apply to the
> localpart of the address.

This makes me nervous, but I can't quite pin down why.  There are cases
like
	if address :contains :all "from" "andrew"
but that's just bad scripting.

I don't see a good reason that COMPARATOR can't apply to the whole
address, it's just useless on the right-side.  Right?

Date: Mon, 22 Feb 1999 16:59:54 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

At 04:50 PM 2/22/99 -0500, Tim Showalter wrote:
>So what happens if we just canonicalize the domain-part to (say) lower
>case for the purposes of header and envelope?  This is simple and should 
>do the job reasonably well.

Sounds good to me.  The COMPARATOR argument would only apply to the
localpart of the address.

Greg Sereda

Date: 22 Feb 1999 16:50:57 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked], Gregory Sereda <[email-masked]>
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

> Date: Mon, 22 Feb 1999 16:48:38 -0500
> From: Gregory Sereda <[email-masked]>

> This still does not fix the problem because the "tim@*" could match
> one address and the "[email-masked]" could match another (different)
> address.

You're right.

> Personally, I would just do a case insensitive compare on the
> entire address.  However, I think will need to revist this if
> we want or expect sieve scripts to distingush between addresses
> like: [email-masked] and [email-masked] which might be different users.

So what happens if we just canonicalize the domain-part to (say) lower
case for the purposes of header and envelope?  This is simple and should 
do the job reasonably well.

Date: Mon, 22 Feb 1999 16:48:38 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

At 03:57 PM 2/22/99 -0500, Tim Showalter wrote:
>That script, in particular, is easily fixed:
>
> if allof ( address :matches :all :comparator "i;octet" "from" "tim@*",
>    address :matches :all "from" "[email-masked]" ) {
>    discard;
>
>I am not sure if this solution generalizes, but I think "match" lets it
>do so rather reasonably.

This still does not fix the problem because the "tim@*" could match
one address and the "[email-masked]" could match another (different)
address.  Both would be true and allof() would be true even though
"tim@*" and "[email-masked]" do not appear in the same To: address.
Remember, tests return true if any header or address matches.

I do not see any way of performing a case sensitive compare on the
localpart of an address and a case insensitive compare on the
domain part of an address when there is the potential of more
than one address.  Each test may return true for different
addresses because they operate indepedently.  There is no way
to tell if both tests were true for the same address.

Personally, I would just do a case insensitive compare on the
entire address.  However, I think will need to revist this if
we want or expect sieve scripts to distingush between addresses
like: [email-masked] and [email-masked] which might be different users.

Greg Sereda

Date: 22 Feb 1999 16:04:05 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: Include vacation in sieve draft?
Sender: [email-masked]

I consider vacation a fairly important use of Sieve.  Our old filtering 
system didn't have it, but you could sort of write it.  John Myers did
so, but most mortal users didn't have a workstation that they could
leave running.

Vacation is not that difficult to implement, so I don't want to hide it
to make life easier on people.  (Sorry.)  If its being in a second
document will discourage implementation, I am tempted to merge it into
the main document.  However, it is three pages of text, which is
substantially more than most other extensions, and I find it more
convienent to have in an external document.

I have no problem with trying to get them both out at the same time;
that's a very reasonable thing to do.

Steve and Gregory would like to see the documents merged.  I guess I'd
like to see one more person say they'd like to see it merged, and I'll
put them together.

Tim

Date: 22 Feb 1999 15:57:10 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: Is envelope missing :comparator arguement?
Sender: [email-masked]

> Date: Mon, 22 Feb 1999 14:29:55 -0500
> From: Gregory Sereda <[email-masked]>

> It appears to me that the ADDRESS-PART arugment, in conjunction with
> the COMPARATOR argument, allows a script to do the "right thing".
> If so, the "envelope" should include the COMPARATOR arugment.

I think this is what was intended.  I have added a COMPARATOR argument
to the envelope test.

Given your argument, which I'm going to attempt to discuss below, there
are three things that we can do:

	(1) nothing
	(2) add COMPARATOR to envelope
	(3) make envelope and address responsible for more address
	    parsing

(1) is dumb.  (2) is easy, so I've done (2).  We can revise the draft to
(3) later if we want.  I'm going to put out a draft real soon now and
(2) is an improvement, if nothing else.

> As an aside, a sieve that wants to do the "right thing" when checking
> for an e-mail address would look like the following....
> 
>  # localpart of address is case-sensitive, domain is not.
>  if allof ( address :is :localpart :comparator "i;octet" "from" "tim",
>     address :is :domain "from" "example.com" ) {
>     discard;
>  }

> 	To: [email-masked]
> 	To: [email-masked]
> 
> Neither one of these user's address match "[email-masked]", but the
> script thinks so.

That script, in particular, is easily fixed:

 if allof ( address :matches :all :comparator "i;octet" "from" "tim@*",
    address :matches :all "from" "[email-masked]" ) {
    discard;

I am not sure if this solution generalizes, but I think "match" lets it
do so rather reasonably.

> The problem is the that the ADDRESS-PART cannot be
> related to another "address" test so both the :localpart and :domain
> parts are operating on the same address.
> 
> It seems to me that this can be fixed by having the "envelope" and
> "address" tests deal (correctly) with the case of the localpart and
> domain part.

That is very difficult to nail down.  Consider this test:

if address :contains "from" "andrew" { ...

Does "andrew" refer to the local-part or the domain-part?

What about the large number of MTAs where local-parts are
case-insensitive? On rare occasions, I get mail to [email-masked],
and filtering on that is a reasonable thing to do.

What about UTF-8 in mail addresses, which is going to happen?

If we're going to go this route, we should just require that the domain-part
be canonicalized to lower (or upper) case, then STILL allow COMPARATOR
to cover case-insensitive local-parts.

Date: 22 Feb 1999 15:46:41 -0500
From: Tim Showalter <[email-masked]>
To: Adam Back <[email-masked]>
Cc: [email-masked]
Subject: Re: comments? hashcash based MTA filtering
Sender: [email-masked]

> Date: Fri, 19 Feb 1999 23:48:50 GMT
> From: Adam Back <[email-masked]>

> I have a proposal for another class of filtering criteria: filtering
> on the basis of a token which consumes CPU time to produce as a method
> to throttle systematic abuse.
> 
> I am requesting comments from this group because it seems the closest
> match of IETF topic to "technical solutions to UBE".  I am open to
> comments as to how best to progress this technical solution.

We are not trying to solve the spam problem.  That said, I like
hashcash.  Adding a test for a hashcash value is trivial.  But getting
Sieve out there is a large amount of work in itself.

> The originator is required to send with email a costly to compute
> token bound to that resource name.  Example: Coyote emails Roadrunner,
> he computes a hash collision on "[email-masked]".  birdseed.org
> runs a MTA filter rejecting mail without hashcash postage.

The problem with this is that it means the amount of computational power 
that a mailing list costs is rather high.

Date: Mon, 22 Feb 1999 14:29:55 -0500
To: [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Is envelope missing :comparator arguement?
Sender: [email-masked]

Filter list memebers,

I was reviewing the "address" and "envelope" tests in the latest sieve
draft, I found that "envelope" seems to be missing a comparator argument.
Both "address" and "envelope" tests deal with internet e-mail addresses.
The "address" test spec points out...

   Internet email-addresses have the somewhat awkward characteristic
   that the mailbox-part [IMAIL] to the left of the at-sign is
   considered case sensitive, and the domain-part to the right of the
   at-sign is case insensitive.  The "address" command does not deal
   with this itself, but provides the ADDRESS-PART argument for allowing
   users to deal with it.

It appears to me that the ADDRESS-PART arugment, in conjunction with
the COMPARATOR argument, allows a script to do the "right thing".
If so, the "envelope" should include the COMPARATOR arugment.

As an aside, a sieve that wants to do the "right thing" when checking
for an e-mail address would look like the following....

 # localpart of address is case-sensitive, domain is not.
 if allof ( address :is :localpart :comparator "i;octet" "from" "tim",
    address :is :domain "from" "example.com" ) {
    discard;
 }

Hmm, looks like ADDRESS-PART and COMPARATOR can't really do what is
intended.  Maybe its OK for a single "From" line, but checking the
address in the multiple "To" lines is broken.  The following message
header will give a false positive:

	To: [email-masked]
	To: [email-masked]

Neither one of these user's address match "[email-masked]", but the
script thinks so.  The problem is the that the ADDRESS-PART cannot be
related to another "address" test so both the :localpart and :domain
parts are operating on the same address.

It seems to me that this can be fixed by having the "envelope" and
"address" tests deal (correctly) with the case of the localpart and
domain part.  The COMPARATOR argument could be dropped from both of
these commands.

Greg Sereda

Date: Mon, 22 Feb 1999 06:48:20 +0100
To: Matthew Wall <[email-masked]>, Sieve Mailing List <[email-masked]>
From: Patrik =?iso-8859-1?Q?F=E4ltstr=F6m?=  <[email-masked]>
Subject: Re: Minneapolis Sieve BOF redux
Cc: Keith Moore <[email-masked]>, [email-masked]
Sender: [email-masked]

At 17.44 -0500 1999-02-21, Matthew Wall wrote:
> At this point, we need a 2-hour BOF. I think the consensus was that if we
> hadn't worked out the residual issues by now, the BOF would be useful in so
> doing, or in focussing on a WG charter.
>
> I will send in a proposed agenda tomorrow, if we can get a slot at this
> point.

You can get the slot, BUT, you need to submit the agenda. 
<[email-masked]> is the address to send it to. cc myself and Keith.

  paf

Date: Sun, 21 Feb 1999 17:44:32 -0500
From: Matthew Wall <[email-masked]>
To: =?ISO-8859-1?Q?Patrik_F=E4ltstr=F6m?= <[email-masked]>, Sieve Mailing List <[email-masked]>
cc: Keith Moore <[email-masked]>
Subject: Re: Minneapolis Sieve BOF redux
Originator-Info: login-id=wall; server=imap.cyrusoft.com
Sender: [email-masked]

--On Sun, Feb 21, 1999 12:24 PM +0100 the entity known as Patrik Fältström
<[email-masked]> wrote:

> 
> So, Matt et.al., what is the status on BOF or not? Keith and I need 
> to know basically today (sunday), and the agenda need to be sent in 
> no later than tomorrow (monday).

To which Matthew Wall offers this response on Sun, 21 Feb 1999 17:43:38
-0500:

At this point, we need a 2-hour BOF. I think the consensus was that if we
hadn't worked out the residual issues by now, the BOF would be useful in so
doing, or in focussing on a WG charter.

I will send in a proposed agenda tomorrow, if we can get a slot at this
point.

Thanks!

- Matt

(List: FYI.)

Date: Sun, 21 Feb 1999 12:24:20 +0100
To: Matthew Wall <[email-masked]>, Sieve Mailing List <[email-masked]>
From: Patrik =?iso-8859-1?Q?F=E4ltstr=F6m?=  <[email-masked]>
Subject: Re: Minneapolis Sieve BOF redux
Cc: Keith Moore <[email-masked]>
Sender: [email-masked]

At 13.10 -0500 1999-01-25, Matthew Wall wrote:
> We have until Feb. 22 to put in a formal request for an agenda slot for a
> BOF at Minneapolis. Obviously, the sooner we can put something in, the
> better the slot...
>
> When I asked about whether to "use" our second BOF, there was a gentle hum
> on the list that we should go ahead and do it, but not what I'd yet call a
> strong consensus. I don't think anyone objected, though, in concept.

So, Matt et.al., what is the status on BOF or not? Keith and I need 
to know basically today (sunday), and the agenda need to be sent in 
no later than tomorrow (monday).

So far, you are _NOT_ on the agenda.

   Patrik

Date: Fri, 19 Feb 1999 23:48:50 GMT
From: Adam Back <[email-masked]>
To: [email-masked]
Subject: comments? hashcash based MTA filtering
Sender: [email-masked]

Hi,

I have a proposal for another class of filtering criteria: filtering
on the basis of a token which consumes CPU time to produce as a method
to throttle systematic abuse.

I am requesting comments from this group because it seems the closest
match of IETF topic to "technical solutions to UBE".  I am open to
comments as to how best to progress this technical solution.

I proposed "hashcash", a CPU cost function based approach to
throttling systematic abuse of unmetered internet protocols (eg UBE
over SMTP), in March 97.  Hashcash is a cpu cost function with tunable
cpu cost, based on partial hash collisions (where hash = cryptographic
message digest such as SHA1). (http://www.dcs.ex.ac.uk/~aba/hashcash/) 
The construct is quite simple and sample code is provided to tinker with.

I think it is mentioned obliquely in the UBE-solutions document at IMC
(http://www.imc.org/ube-sol.html) as I sent comment on it to the
author.

: 4.3. Filter based on previous acceptance of mail
: 
: A mail client can filter based on whether the user had previously
: accepted a message from this sender.  This happens as the recipient is
: receiving messages. If the sender is new to the recipient, the
: recipient's client somehow "challenges" the sender to prove whether
: the client should accept the message. Some of the types of suggested
: challenges include just a response, a response that takes
: computational power (computing a problem given in the challenge), and
: monetary payment.

The "response that takes computation power" is a reference to hashcash
I think.

A (20 line) description of hashcash (see
http://www.dcs.ex.ac.uk/~aba/hashcash/ for better explanation):

======================================================================
The originator is required to send with email a costly to compute
token bound to that resource name.  Example: Coyote emails Roadrunner,
he computes a hash collision on "[email-masked]".  birdseed.org
runs a MTA filter rejecting mail without hashcash postage.

The collisions are based on SHA1.  With tuning parameter t set to 16
bits, Coyote must find (by brute force) a string of form
"[email-masked]" (where X is a number), which produces
16 bits of hash collision with the hash of [email-masked].
Under unix:

% echo -n [email-masked]'  | sha1
6fc0af015d2b20b545ff44726c6d26e09397d60a

and try sequentially [email-masked] etc until a sha1
output with the last 16 bits the same is found such as (the faked):

% echo -n [email-masked]'  | sha1
af6fb545ff44c0015d2e09ffb20726c6d26fd60a
                                    ^^^^
(the last 4 hex nibbles = 16 bits are the same).
======================================================================

It needs originating support in SMTP clients, and either MTA filtering
or local filtering on the recipient side.

(You can do common sense optimisations such as exemption lists, and
non-expiring free-reply tokens etc. to allow mailing lists to not
require hashcash, and to avoid normal correspondents from needing
hashcash all the time.  And encoding the hashcash in the email
address.)

There are lots of different permutations in which one could use
hashcash.  The major problem as identified in the effects table for
the above quoted section in the UBE-sol document is that:

: Some legitimate mail might go unread if the sender does not reply to
: the challenge. All initial contact will also include challenges,
: which might make the original sender less interested in
: communicating with the recipient.

The problem is of deployment: 5% of people using hashcash is
problematic because lots of bounced mail will ensue.  95% of people
using hashcash would seriously dent a UBE originators volume, and put
pressure on the remaining 5% to convert.  Denting volume won't
_prevent_ UBE people, but it will make them think about targetting
people who are likely to be interested.  A good solution I think.

The problem is how to get from here to there.  One suggestion might be
to have a cut off point.  Jan 2003 turn it on, before that deploy it.
But how realistic is it to achieve that.  Not very probably.

Comments!

Adam

From: Steve Hole <[email-masked]>
Date: Fri, 19 Feb 1999 09:37:19 -0700
To: Gregory Sereda <[email-masked]>
Subject: Re: Include vacation in sieve draft?
Cc: [email-masked]
Sender: [email-masked]

On Wed, 17 Feb 1999 13:25:45 -0500 Gregory Sereda 
<[email-masked]> wrote:

> Filter list members,
> 
> Originally, vacation was thought of as an sieve extension because not
> all sites could support it.  Therefore, it was described in a separate
> draft.  Now that sieve has several optional features, like reject
> fileinto, envelope, why don't we incoporated "vacation" as just
> another optional feature in the sieve spec?

I think this is a wonderful idea.    I would claim that vacation and 
forwarding support are the most *generally* useful features of Sieve 
because there are other ways of getting the effects of fileinto -- 
especially in an IMAP4 client.     Not to start a holy war -- I'm just 
saying that there is *no* other way to get forwarding and vacation 
capabilities for a distributed mail client, and we desparately need that 
capability.

Cheers.
---  
Steve Hole                           
Execmail Inc.
Mailto:[email-masked] 
Phone: 780-424-4922

Date: Fri, 19 Feb 1999 11:31:50 -0500
From: Tony Hansen <[email-masked]>
Organization: AT&T Laboratories
To: Gregory Sereda <[email-masked]>
CC: Edward Hibbert <[email-masked]>, Sieve List <[email-masked]>
Subject: Re: Include vacation in sieve draft?
Sender: [email-masked]

Gregory Sereda wrote:
> 
> At 09:40 AM 2/18/99 UT, Edward Hibbert wrote:
> >What do other implementors think?
> 
> Tim made a good point that vacation serves as an example of
> how to write a sieve extension.

Another option is to try to get them published as a pair and have
cross-references between the two, so that it is obvious that they are
together.

Publishing RFCs together is done fairly often by the RFC editor.

	Tony Hansen
	[email-masked]

Date: Fri, 19 Feb 1999 11:26:10 -0500
From: Tony Hansen <[email-masked]>
Organization: AT&T Laboratories
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

Michael Salmon wrote:
> 
> +----- On 18 Feb 1999 23:04:47 EST, Tim Showalter writes:
> | > Date: 18 Feb 1999 22:12:43 -0500
> | > From: Tim Showalter <[email-masked]>
> |
> | > > >         The subject is set to the specified :subject string, if present.
> | > > > Otherwise, the subject is set to the characters "Re: " followed by the
> | > > > original subject with all leading occurrences of the characters "Re: "
> | > > > stripped off.
> |
> | > I have used this exact text.  It may be a little vauge, but I'm not sure
> | > I can improve on it much.  If that isn't okay, please let me know.
> |
> | actually, I didn't use that exact text, just the parts I liked.  The
> | text I added was
> |
> | Users can specify the subject of the reply with the ":subject"
> | parameter.  If the :subject parameter is not supplied, then the
> | subject is generated as follows: The subject is set to the
> | characters "Re: " followed by the original subject with all
> | leading occurances of the characters "Re: " stripped off.
> 
>   I have noticed that there are are number of national variants to re:
> in common use, in swedish it is sv: and I think german uses av:. I think
> that using re: in replies is ok although it could be a site defined
> parameter but that all leading short words ending in : should be
> stripped.

This has been discussed extensively on the DRUMS list. The consensus
there is that the latin abbreviation "Re: " is the string that is to be
used on-the-wire for all replies, and that mail user agents (MUA's)
should display the string in whatever manner is appropriate for the
locale in use (sv:,aw:,etc.), but never transmit those other strings. (I
think I summarized that right.)

>From draft-ietf-drums-msg-fmt-07.txt, section 3.6.5: 
  ... The "Subject:" field is the most common
  and contains a short string identifying the topic of the message. When
  used in a reply, the field body MAY start with the string "Re: " (from
  the Latin "res", in the matter of) followed by the contents of the
  "Subject:" field body of the original message. If this is done, only
one
  instance of the literal string "Re: " ought to be used since use of
  other strings or more than one instance can lead to undesirable
  consequences.

I think it is best to stick to just stripping off the latin abbreviation
and not strip off anything else.

	Tony Hansen
	[email-masked]

Date: Fri, 19 Feb 1999 11:22:22 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: sieve-06bis
Sender: [email-masked]

At 03:11 PM 2/11/99 -0500, Tim Showalter wrote:
>Hi.  This draft has some of the changes folks have asked for.

Somewhere along the line we droped the section for "test true"....
5.6.     Test false ...............................................   26
5.X.     Test true  <missing>

Greg Sereda

Date: Fri, 19 Feb 1999 08:39:51 -0700
From: Alexey Melnikov <[email-masked]>
To: Michael Salmon <[email-masked]>
CC: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

Michael Salmon wrote:

> +----- On 18 Feb 1999 23:04:47 EST, Tim Showalter writes:
> | > Date: 18 Feb 1999 22:12:43 -0500
> | > From: Tim Showalter <[email-masked]>
> |
> | > > >         The subject is set to the specified :subject string, if present.
> | > > > Otherwise, the subject is set to the characters "Re: " followed by the
> | > > > original subject with all leading occurrences of the characters "Re: "
> | > > > stripped off.
> |
> | > I have used this exact text.  It may be a little vauge, but I'm not sure
> | > I can improve on it much.  If that isn't okay, please let me know.
> |
> | actually, I didn't use that exact text, just the parts I liked.  The
> | text I added was
> |
> | Users can specify the subject of the reply with the ":subject"
> | parameter.  If the :subject parameter is not supplied, then the
> | subject is generated as follows: The subject is set to the
> | characters "Re: " followed by the original subject with all
> | leading occurances of the characters "Re: " stripped off.
>
>   I have noticed that there are are number of national variants to re:
> in common use, in swedish it is sv: and I think german uses av:. I think
> that using re: in replies is ok although it could be a site defined
> parameter but that all leading short words ending in : should be
> stripped.

I don't like your idea. It was consensus in DRUMS mailing list that mail clients
must not generate anything except Re: in replies (However they are free to show it
as sv: or whatever).

--
Regards,
AMelnikov

Date: Fri, 19 Feb 1999 09:47:40 -0500
To: "Edward Hibbert" <[email-masked]>, "Sieve List" <[email-masked]>
From: Gregory Sereda <[email-masked]>
Subject: RE: Include vacation in sieve draft?
Sender: [email-masked]

At 09:40 AM 2/18/99 UT, Edward Hibbert wrote:
>What do other implementors think?

Tim made a good point that vacation serves as an example of
how to write a sieve extension.

However, adding vacation to the sieve draft has some advantages:

	- easier to find/understand since it is in one place.
	- easier to maintain for same reason, eg last draft example
         was using the older "forward" rather than "redirect".
	- provides needed functionality since "reply" was removed
         from the sieve standard.

If Edward's customers need vacation functionality, I am not sure
they will feel better knowing they can't have it because it is
an "extension" to sieve rather than a "optional" feature of sieve,
unless they are unaware the "vacation" extension exists.

In the end, I'll defer to Tim's judgement, since most of the 
burden rests on him to shepherd another draft through the process.
>From a technical perspective, there is no difference between an
"optional" feature in sieve and an "extension" of sieve.

Greg Sereda

To: [email-masked]
Subject: Re: sieve vacation draft, really 
Date: Fri, 19 Feb 1999 09:47:33 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

+----- On 18 Feb 1999 23:04:47 EST, Tim Showalter writes:
| > Date: 18 Feb 1999 22:12:43 -0500
| > From: Tim Showalter <[email-masked]>
| 
| > > > 	The subject is set to the specified :subject string, if present.
| > > > Otherwise, the subject is set to the characters "Re: " followed by the
| > > > original subject with all leading occurrences of the characters "Re: "
| > > > stripped off.
| 
| > I have used this exact text.  It may be a little vauge, but I'm not sure 
| > I can improve on it much.  If that isn't okay, please let me know.
| 
| actually, I didn't use that exact text, just the parts I liked.  The
| text I added was
| 
| Users can specify the subject of the reply with the ":subject"
| parameter.  If the :subject parameter is not supplied, then the
| subject is generated as follows: The subject is set to the
| characters "Re: " followed by the original subject with all
| leading occurances of the characters "Re: " stripped off.

  I have noticed that there are are number of national variants to re:
in common use, in swedish it is sv: and I think german uses av:. I think
that using re: in replies is ok although it could be a site defined
parameter but that all leading short words ending in : should be
stripped.

/Michael

Date: 18 Feb 1999 23:04:47 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

> Date: 18 Feb 1999 22:12:43 -0500
> From: Tim Showalter <[email-masked]>

> > > 	The subject is set to the specified :subject string, if present.
> > > Otherwise, the subject is set to the characters "Re: " followed by the
> > > original subject with all leading occurrences of the characters "Re: "
> > > stripped off.

> I have used this exact text.  It may be a little vauge, but I'm not sure 
> I can improve on it much.  If that isn't okay, please let me know.

actually, I didn't use that exact text, just the parts I liked.  The
text I added was

	Users can specify the subject of the reply with the ":subject"
	parameter.  If the :subject parameter is not supplied, then the
	subject is generated as follows: The subject is set to the
	characters "Re: " followed by the original subject with all
	leading occurances of the characters "Re: " stripped off.

Date: 18 Feb 1999 22:14:19 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: sieve-vacation: in-reply-to set to message-id of original message
Sender: [email-masked]

I have added this paragraph to the vacation draft:

Replies must have the In-Reply-To field set to the Message-ID of the
original message.

Is this okay?

Date: 18 Feb 1999 22:12:43 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

> Date: Wed, 17 Feb 1999 22:08:09 -0800 (PST)
> From: Ned Freed <[email-masked]>

> > Suggestion #2:
> 
> > 	Add the optional argument :subject <string> to the grammar for the
> > command.
> 
> > 	The subject is set to the specified :subject string, if present.
> > Otherwise, the subject is set to the characters "Re: " followed by the
> > original subject with all leading occurrences of the characters "Re: "
> > stripped off.
> 
> > I like the second suggestion better.
> 
> So do I.

I have used this exact text.  It may be a little vauge, but I'm not sure 
I can improve on it much.  If that isn't okay, please let me know.

X400-Received: by/C=GB/A=TMAILUK/P=DCSMTP/;Relayed;18 Feb 1999 09:34:26 UT
X400-Received: by/C=GB/A=TMAILUK/P=DCNET/;Relayed;18 Feb 1999 09:40:27 UT
Date: 18 Feb 1999 09:40:27 UT
X400-MTS-Identifier: [/C=GB/A=TMAILUK/P=DCNET/;SCOFFMAIL-990218094027Z-4983]
X400-Originator: [email-masked]
Conversion: Allowed
Conversion-With-Loss: Allowed
Original-Encoded-Information-Types: (2)(6)(3)(4)(2)
X400-Recipients: [email-masked]
From: "Edward Hibbert" <[email-masked]>
To: "Sieve List" <[email-masked]>  (Receipt Notification Requested)
Subject: RE: Include vacation in sieve draft?
Importance: Normal
Sender: [email-masked]

I have a preference for this being an extension rather than 
incorporating it into the draft.  We are already receiving 
customer demands for support of SIEVE, and are working on an 
implementation.  So we'd like to avoid too much function creep 
in the draft, because our customers will (naturally) want us to 
support all the optional features too.

I appreciate that the point I'm making is not a technical 
argument, but I think it's good to get a standard out there for 
implementors to work to.  The current draft contains a useful 
level of function, so we'd rather that SIEVE made it to a 
standard and then extensions such as vacation were added on later,
 as with IMAP.

What do other implementors think?

Edward Hibbert
DCL

----------
From: 	Gregory Sereda 
Sent: 	17 February 1999 18:25
To: 	"[email-masked]" 
Subject: 	Include vacation in sieve draft?

Filter list members,

Originally, vacation was thought of as an sieve extension 
because not
all sites could support it.  Therefore, it was described in a 
separate
draft.  Now that sieve has several optional features, like 
reject
fileinto, envelope, why don't we incoporated "vacation" as 
just
another optional feature in the sieve spec?

I assume, althought its not stated, that scripts would need to
use the "require" action before using "vacation" as other
optional features are handled.  If so, the example should
be updated to show it.  Also, current example in vacation
has syntax error because it uses the older "forward", not
the current "redirect" action.
 
  Example:
             require "vacation";
             ^^^^^^^^^^^^^^^^^^^ added required check!!
             if header: contains "from" "[email-masked]" {
                forward "[email-masked]";
                ^^^^^^^ syntax, now called "redirect"
             } elsif header: contains ["to", "cc"]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ redundant, 
vacation
checks
                   "[email-masked]" {
                vacation "Sorry, I'm away, I'll read your 
message
                   when I get around to it.";
             }

Date: Wed, 17 Feb 1999 22:08:09 -0800 (PST)
From: Ned Freed <[email-masked]>
Subject: Re: sieve vacation draft, really
To: Tony Hansen <[email-masked]>
Cc: [email-masked]
Sender: [email-masked]

> Tim Showalter wrote:
> >
> > This is a second stab at a vacation extension.  Please take a look at it.

> The draft makes no mention of what the subject should set to for the
> message sent back.

I agree that there needs to be an option to do this. People really want
to be able to set the subject on messages of this sort.

> Suggestion #1:

> 	The subject is set to the characters "Re: " followed by the original
> subject with all leading occurrences of the characters "Re: " stripped
> off.

> Suggestion #2:

> 	Add the optional argument :subject <string> to the grammar for the
> command.

> 	The subject is set to the specified :subject string, if present.
> Otherwise, the subject is set to the characters "Re: " followed by the
> original subject with all leading occurrences of the characters "Re: "
> stripped off.

> I like the second suggestion better.

So do I.

				Ned

Date: Wed, 17 Feb 1999 18:57:07 -0800
From: "J.D. Falk" <[email-masked]>
To: Tony Hansen <[email-masked]>, [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

On 02/17/99, Tony Hansen <[email-masked]> wrote: 

> Suggestion #2:
> 
> 	Add the optional argument :subject <string> to the grammar for the
> command.
> 
> 	The subject is set to the specified :subject string, if present.
> Otherwise, the subject is set to the characters "Re: " followed by the
> original subject with all leading occurrences of the characters "Re: "
> stripped off.
> 
> I like the second suggestion better.

	Me too.  Options are good.

-- 
J.D. Falk <[email-masked]>                     Got clue?  http://www.ispf.com/
Special Agent In Charge (Abuse Issues)
Critical Path, Inc.

Date: Wed, 17 Feb 1999 21:41:11 -0500
From: Tony Hansen <[email-masked]>
Organization: AT&T Laboratories
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

Tim Showalter wrote:
> 
> This is a second stab at a vacation extension.  Please take a look at it.

The draft makes no mention of what the subject should set to for the
message sent back.

Suggestion #1:

	The subject is set to the characters "Re: " followed by the original
subject with all leading occurrences of the characters "Re: " stripped
off.

Suggestion #2:

	Add the optional argument :subject <string> to the grammar for the
command.

	The subject is set to the specified :subject string, if present.
Otherwise, the subject is set to the characters "Re: " followed by the
original subject with all leading occurrences of the characters "Re: "
stripped off.

I like the second suggestion better.

	Tony Hansen
	[email-masked]

Date: Wed, 17 Feb 1999 16:00:18 -0800
From: "J.D. Falk" <[email-masked]>
To: Steve Simitzis <[email-masked]>, [email-masked]
Subject: Re: network extension proposal
Sender: [email-masked]

On 02/16/99, Steve Simitzis <[email-masked]> wrote: 

> The ability to filter messages based on their origin (or supposed
> origin) would allow for powerful spam filtering techniques. Please let
> me know if this sounds useful. I can write this up more formally, if
> there is any interest.

	I'm very interested!  Oh, wait, we're working on the same
	implementation.  *grin*

	As a bit of background for the rest of the list...since the
	same sieve language can be used for general server, domain,
	or individual user-specific filters on either the server or
	client side, we've been looking at a server implementation
	as a starting point for Critical Path's MTA.

	This is, obviously, a somewhat different perspective.

-- 
J.D. Falk <[email-masked]>                     Got clue?  http://www.ispf.com/
Special Agent In Charge (Abuse Issues)
Critical Path, Inc.

Date: Wed, 17 Feb 1999 15:34:55 -0800 (PST)
From: Ned Freed <[email-masked]>
Subject: Re: sieve-06bis
To: "Carl S. Gutekunst" <[email-masked]>
Cc: Michael Salmon <[email-masked]>, [email-masked]
Sender: [email-masked]

> > | > I think that ISO-8859-15 would be more appropriate than -1, it fixes
> > | > the bugs in -1 and adds the euro.
> > |
> > | For better or worse, I believe 8859-1 is more common and should be
> > | required, but I don't have a string opinion on the subject.
> >
> > It is the case today but it is unlikely to be the case when sieve
> > become a standard. The most important reason is the replacement of the
> > generic money symbol (0xa4 ¤) with the euro symbol but it also includes
> > some of the characters that they missed in Latin1.

> Expect the impact of 8859-15 (so-called Latin 0) to be negligible. The only
> vendors who are supporting it are those who have weak Unicode implementations.

Had anyone asked me to predict the impact of iso-8859-15 in advance this is
certainly what I would have said. However, this is not what I'm observing in
practice -- we've had a number of customers ask for 8bit charsets that contain
the Euro and iso-8859-15 support in particular. (And this despite the fact
we've had reasonably complete Unicode support in place for years that nobody
seems terribly interested in.)

> The dominent desktop is Microsoft Windows, and it supports the Euro just fine
> through Unicode; I have yet to see any application on MS Windows that supports
> 8859-15.

This may be true but I think it misses the point. Having good application
support for iso-8859-15 isn't really necessary; all you have to have something
that supports an 8bit single byte charset and then all you have to do is use
the right character tables. By contrast, getting full support for Unicode in
place is vastly more difficult.

However, I'm far from convinced this will result in wholesale replacement of
iso-8859-1 with iso-8859-15. At most I'd be willing to add iso-8859-15 to the
list of must-decode charsets, but that's as far as I'd be willing to go.

				Ned

Date: 17 Feb 1999 17:06:53 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve-06bis 
Sender: [email-masked]

> Date: Wed, 17 Feb 1999 11:37:58 +0100

> | > | 2.10.3.  Message Uniqueness in a Mailbox
> | > | 
> | > | Implementations SHOULD NOT write a message to a mailbox where a copy
> | > | of it already exists, even if a script explicitally asks for a
> | > | message to be written to a mailbox twice.
> | > | 
> | > | The test for equality of two messages is not defined by this memo.
> | > 
> | > I think that this is a little tough although of course it isn't 
> | > mandatory. Perhaps it should be mandatory for a script to not deliver 
> | > more than once to a mailbox .
> | 
> | I'm not sure what you want.  That language is weasily enough to allow an 
> | awful lot, quite possibly too much.
> | 
> | The reason for that second paragraph is that I consider two messages
> | with the same message-id equal enough, but others will want to compare
> | bodies in some meaningful way.
> 
> What I meant was that a message must be actively delivered into a 
> mailbox twice during a single execution of the script. It would be nice 
> if it could suppress the duplication of existing messages but I think 
> that that could be too hard in some cases.

I don't understand your first sentence.  I can't find a case where I
want to write a message to a mailbox twice, ever.  So I've written this,
which says you shouldn't do that.

Do you want implementations to be able to write a message to a mailbox
twice?  Why?

Implementations are supposed to avoid writing messages to mailboxes if
copies of the messages already exist.  They are allowed to do so if they 
really want to.

What would you like the document to say?

> Should a message that is identical to a message that has been stored 
> and then deleted be considered a duplicate? I think that it is 
> acceptable but should not be mandatory.

Because I didn't define equality, that's a reasonable behavior.  (That
is the behavior I want.)

> | > What should happen if a require is not satisfied? I would guess that a 
> | > required extension would be checked when the script was loaded but what 
> | > happens if an extension is removed?
> | 
> | The script doesn't run at all.  I've added this sentence to 2.10.5:
> | 
> | | If a script does not understand an extension declared with require,
> | | the script must not be used at all.
> 
> Good, does the action of sieve in this case need to be defined. As I 
> see it there are 2 possibilities, 
> 1) perform a keep i.e. pretend that the script is null
> 2) write the message back into the queue
> In both cases an error message should be written into the mailbox I 
> think, though preferably never more than one.

We punted on this as a quality of implementation issue.  I believe the
correct behavior is (1) (writing back to the queue when I've gone on
vacation is not what I want) but it was decided not to define it.

> Another thing that comes to mind is when are requires examined? Can 
> they exist inside if statements? I can see advantages to that but it 
> also seems to leave the way open for behaviour that is hard to debug.

I would make requires magical but I believe following from the lack of
definitions of failure behavior described above, we can't define this
unless we define error behavior.

I'm not sure I like what's in the document, but because some folks have
expressed desire not to demand seperate parse/evaluate/execute stages,
anything that suggested such behavior was removed.

> | > | In order to prevent mail loops, an implementation MUST refuse to
> | > | filter a message that it has already filtered once; that is, a
> | > | message must not pass through a given server twice.
> | > 
> | > This seems excessive to me, especially as servers are becoming larger 
> | > and larger all the time. I think that mail loops would be prevented if 
> | > a message could only be kept or discarded when it had been seen twice 
> | > by the same user.
> | 
> | How would one write such a script?
> 
> What I had in mind was that redirect was a null action on any message 
> that had been seen. If nothing else was done then an implicit keep 
> would be performed.

> | | In order to prevent mail loops, implementations must prevent messages
> | | from passing through a given user twice.

> I agree, it seems to fit in well with 2.10.3, in the best of all 
> possible worlds no matter what strange things you do you only get one 
> copy of a message.

I think what you're asking for is that a Sieve script ignores
"redirects" if it's seen this message before, possibly detectable by the
addition of a header.  That's not a bad idea, actually.  Anyone else
care for this?

Date: 17 Feb 1999 16:50:57 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve vacation draft, really 
Sender: [email-masked]

> Date: Wed, 17 Feb 1999 18:20:56 +0100

> | The ":days" argument is used to specify the period in which addresses
> | are kept and are not responded to, and is always specified in days.
> | The minimum and default value is 7.
> | 
> | "Vacation" keeps track of all of the addresses that it has responded
> | to in some period (as specified by the :days optional argument).  If
> | vacation has not previously responded to this address within that
> | time period, it sends the "reason" argument to the Return-Path
> | address of the message that is being responded to.
> 
> Shouldn't :days have a maximum as well as a minimum?

Yes, added:

	The ":days" argument is used to specify the period in which
	addresses are kept and are not responded to, and is always
	specified in days.  The minimum value used for this parameter is
	1.  Sites MAY define a different minimum value.  Sites MAY also
	define a maximum days value, which MUST be greater than 7, and
	SHOULD be greater than 30.

and:

	If ":days" exceeds the site-defined maximum, the site-defined
	maximum is used instead.

> Presumably one can have more than vacation statement in a script and
> if that is the case must all :days be the same? What happens if they
> aren't? Should the respondent lists be independent?

What's the problem?

I don't have strong motivation for making multiple vacations in a single
script act specially, although I believe that a given script should only
send out a vacation message once.

> I think that having independent vacation messages should be allowed but 
> that the effect of differing dates be implementation defendant.

Why?

> I also feel that it should be possible to clear the respondent lists
> so that new messages are distibuted.

I oppose this on two grounds: first, how does one clear the respondant
lists?  Such things are very implementation dependant, and I'd rather
just not discuss them.  Second, Those features are in vacation for
safety reasons; earlier drafts had a command that did not have them
called "reply" that were removed for these reasons.

Date: 17 Feb 1999 16:44:37 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: Include vacation in sieve draft?
Sender: [email-masked]

> Date: Wed, 17 Feb 1999 13:25:45 -0500
> From: Gregory Sereda <[email-masked]>
> 
> Filter list members,
> 
> Originally, vacation was thought of as an sieve extension because not
> all sites could support it.  Therefore, it was described in a separate
> draft.  Now that sieve has several optional features, like reject
> fileinto, envelope, why don't we incoporated "vacation" as just
> another optional feature in the sieve spec?

While I prefer the idea of vacation as an extension, we could do this.

The only good reason I can think of for making it a seperate document is 
that it can serve as an example of how to write an extension.

> I assume, althought its not stated, that scripts would need to
> use the "require" action before using "vacation" as other
> optional features are handled.  If so, the example should
> be updated to show it.  Also, current example in vacation
> has syntax error because it uses the older "forward", not
> the current "redirect" action.

Fixed, thanks.

Date: Wed, 17 Feb 1999 12:30:11 -0800
From: "J.D. Falk" <[email-masked]>
To: Gregory Sereda <[email-masked]>, [email-masked]
Subject: Re: Include vacation in sieve draft?
Sender: [email-masked]

On 02/17/99, Gregory Sereda <[email-masked]> wrote: 

> Originally, vacation was thought of as an sieve extension because not
> all sites could support it.  Therefore, it was described in a separate
> draft.  Now that sieve has several optional features, like reject
> fileinto, envelope, why don't we incoporated "vacation" as just
> another optional feature in the sieve spec?

	Sounds good to me, FWIW.

	Out of curiosity...are there any other draft extensions to
	sieve floating around at the moment?

-- 
J.D. Falk <[email-masked]>                     Got clue?  http://www.ispf.com/
Special Agent In Charge (Abuse Issues)
Critical Path, Inc.

Date: Wed, 17 Feb 1999 13:25:45 -0500
To: [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Include vacation in sieve draft?
Sender: [email-masked]

Filter list members,

Originally, vacation was thought of as an sieve extension because not
all sites could support it.  Therefore, it was described in a separate
draft.  Now that sieve has several optional features, like reject
fileinto, envelope, why don't we incoporated "vacation" as just
another optional feature in the sieve spec?

I assume, althought its not stated, that scripts would need to
use the "require" action before using "vacation" as other
optional features are handled.  If so, the example should
be updated to show it.  Also, current example in vacation
has syntax error because it uses the older "forward", not
the current "redirect" action.
 
  Example:
             require "vacation";
             ^^^^^^^^^^^^^^^^^^^ added required check!!
             if header :contains "from" "[email-masked]" {
                forward "[email-masked]";
                ^^^^^^^ syntax, now called "redirect"
             } elsif header :contains ["to", "cc"]
                     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ redundant, vacation checks
                   "[email-masked]" {
                vacation "Sorry, I'm away, I'll read your message
                   when I get around to it.";
             }

To: [email-masked]
Subject: Re: sieve vacation draft, really 
Date: Wed, 17 Feb 1999 18:20:56 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

+----- On 15 Feb 1999 15:40:08 EST, Tim Showalter writes:
[...]
| The ":days" argument is used to specify the period in which addresses
| are kept and are not responded to, and is always specified in days.
| The minimum and default value is 7.
| 
| "Vacation" keeps track of all of the addresses that it has responded
| to in some period (as specified by the :days optional argument).  If
| vacation has not previously responded to this address within that
| time period, it sends the "reason" argument to the Return-Path
| address of the message that is being responded to.

Shouldn't :days have a maximum as well as a minimum? I could just image 
what might happen if I set :days to 1000000. I like the idea of site 
defined limits. Presumably one can have more than vacation statement in 
a script and if that is the case must all :days be the same? What 
happens if they aren't? Should the respondent lists be independent?

I think that having independent vacation messages should be allowed but 
that the effect of differing dates be implementation defendant. I also 
feel that it should be possible to clear the respondent lists so 
that new messages are distibuted.

| "Vacation" never responds to a message unless the user's email
| address is in the "To" or "Cc" line of the original message.
| Implementations are assumed to be able to know this information, but
| users may have additional addresses beyond the control of the local
| mail system.
[...]
| By mingling vacation with other rules, users can do something more
| selective.
| 
| Example:
| if header :contains "from" "[email-masked]" {
| forward "[email-masked]";
| } else {
| if header :contains ["to", "cc"] "[email-masked]" {
  ^^^^^^^^^^^^ I think that this is redundant as the test is implicit 
in vacation.

| vacation "Sorry, I'm away, I'll read your message when
| I get around to it.";
| }

/Michael

Date: Wed, 17 Feb 1999 08:25:35 -0800 (PST)
From: "Carl S. Gutekunst" <[email-masked]>
Reply-To: "Carl S. Gutekunst" <[email-masked]>
Subject: Re: sieve-06bis 
To: Michael Salmon <[email-masked]>
Cc: [email-masked]
Sender: [email-masked]

> | > I think that ISO-8859-15 would be more appropriate than -1, it fixes 
> | > the bugs in -1 and adds the euro.
> | 
> | For better or worse, I believe 8859-1 is more common and should be
> | required, but I don't have a string opinion on the subject.
> 
> It is the case today but it is unlikely to be the case when sieve 
> become a standard. The most important reason is the replacement of the 
> generic money symbol (0xa4 ¤) with the euro symbol but it also includes 
> some of the characters that they missed in Latin1.

Expect the impact of 8859-15 (so-called Latin 0) to be negligible. The only
vendors who are supporting it are those who have weak Unicode implementations.
The dominent desktop is Microsoft Windows, and it supports the Euro just fine
through Unicode; I have yet to see any application on MS Windows that supports
8859-15.

<csg>

To: [email-masked]
Subject: Re: sieve-06bis 
Date: Wed, 17 Feb 1999 11:40:36 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

+----- On Tue, 16 Feb 1999 16:10:58 PST, "J.D. Falk" writes:
| On 02/16/99, Michael Salmon <[email-masked]> wrote: 
| 
| > | In order to prevent mail loops, an implementation MUST refuse to
| > | filter a message that it has already filtered once; that is, a
| > | message must not pass through a given server twice.
| > 
| > This seems excessive to me, especially as servers are becoming larger 
| > and larger all the time. I think that mail loops would be prevented if 
| > a message could only be kept or discarded when it had been seen twice 
| > by the same user.
| 
| I don't think this RFC is the place to specify how to stop
| mail loops, except insofar as "an implementation SHOULD be
| smart enough to prevent looping of messages."  A seperate
| "Best Current Practice" draft would be more appropriate,
| and I'd love to work with somebody on that.

That seems reasonable though prevention of mail loops should be 
mandatory.

/Michael

To: [email-masked]
Subject: Re: sieve-06bis 
Date: Wed, 17 Feb 1999 11:37:58 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

+----- On 16 Feb 1999 17:26:53 EST, Tim Showalter writes:
| > Date: Tue, 16 Feb 1999 11:01:03 +0100
| > From: Michael Salmon <[email-masked]>
| 
| > | Implementations decode header charsets to UTF-8.  Two strings are
| > | considered equal if their UTF-8 representations are identical.
| > | Implementations should decode charsets represented in the forms
| > | specified by [MIME] for both message headers and bodies.
| > | Implementations must be capable of decoding US-ASCII, ISO-8859-1,
| > | the ASCII subset of ISO-8859-* character sets, and UTF-8.
| > 
| > I think that ISO-8859-15 would be more appropriate than -1, it fixes 
| > the bugs in -1 and adds the euro.
| 
| For better or worse, I believe 8859-1 is more common and should be
| required, but I don't have a string opinion on the subject.
| 
| Is this not the case?

It is the case today but it is unlikely to be the case when sieve 
become a standard. The most important reason is the replacement of the 
generic money symbol (0xa4 ¤) with the euro symbol but it also includes 
some of the characters that they missed in Latin1.

[...]
| > [...]
| > | 2.10.3.  Message Uniqueness in a Mailbox
| > | 
| > | Implementations SHOULD NOT write a message to a mailbox where a copy
| > | of it already exists, even if a script explicitally asks for a
| > | message to be written to a mailbox twice.
| > | 
| > | The test for equality of two messages is not defined by this memo.
| > 
| > I think that this is a little tough although of course it isn't 
| > mandatory. Perhaps it should be mandatory for a script to not deliver 
| > more than once to a mailbox .
| 
| I'm not sure what you want.  That language is weasily enough to allow an 
| awful lot, quite possibly too much.
| 
| The reason for that second paragraph is that I consider two messages
| with the same message-id equal enough, but others will want to compare
| bodies in some meaningful way.

What I meant was that a message must be actively delivered into a 
mailbox twice during a single execution of the script. It would be nice 
if it could suppress the duplication of existing messages but I think 
that that could be too hard in some cases.

Should a message that is identical to a message that has been stored 
and then deleted be considered a duplicate? I think that it is 
acceptable but should not be mandatory.

| > What should happen if a require is not satisfied? I would guess that a 
| > required extension would be checked when the script was loaded but what 
| > happens if an extension is removed?
| 
| The script doesn't run at all.  I've added this sentence to 2.10.5:
| 
| | If a script does not understand an extension declared with require,
| | the script must not be used at all.

Good, does the action of sieve in this case need to be defined. As I 
see it there are 2 possibilities, 
1) perform a keep i.e. pretend that the script is null
2) write the message back into the queue
In both cases an error message should be written into the mailbox I 
think, though preferably never more than one.

Another thing that comes to mind is when are requires examined? Can 
they exist inside if statements? I can see advantages to that but it 
also seems to leave the way open for behaviour that is hard to debug.

[...]
| > [...]
| > | In order to prevent mail loops, an implementation MUST refuse to
| > | filter a message that it has already filtered once; that is, a
| > | message must not pass through a given server twice.
| > 
| > This seems excessive to me, especially as servers are becoming larger 
| > and larger all the time. I think that mail loops would be prevented if 
| > a message could only be kept or discarded when it had been seen twice 
| > by the same user.
| 
| How would one write such a script?

What I had in mind was that redirect was a null action on any message 
that had been seen. If nothing else was done then an implicit keep 
would be performed.

| I think that this should be on a per-user basis, not a per-server basis,
| and I'll fix it accordingly:
| 
| | In order to prevent mail loops, implementations must prevent messages
| | from passing through a given user twice.
| 
| I think this is what I intended, and I believe it's a clear improvement.
| 
| I only want to discuss the case where a user relays a message to himself 
| (i.e., a loop).  Two messages with the same message-id can have
| different return-path values (say, if one hits a mailing list) and I
| don't want to require anything in that case; that's normal and fine and
| scripts should handle it accordingly.

I agree, it seems to fit in well with 2.10.3, in the best of all 
possible worlds no matter what strange things you do you only get one 
copy of a message.

/Michael

Date: Wed, 17 Feb 1999 01:51:55 +0000 (GMT)
From: Steve Simitzis <[email-masked]>
To: [email-masked]
Subject: network extension proposal
Sender: [email-masked]

It has been necessary in our spam blocking efforts to write code that allows
our MTA to filter against the HELO string, the hostname, and IP address of 
the remote mail host during an SMTP transaction. 

To support this with a sieve implementation, I propose the "network" test. 
This would be used to define filter rules that test the remote relay's 
network identity.

Examples:

1) Spammers frequently send invalid or forged HELO strings (such as: 
HELO www.hotmail.com).

2) Some IP addresses and netblocks are known to be operated by spammers.
It might also be interesting to have the ability to do RBL checking.

3) Some patterns of hostnames are known to be dial-in users (example:
dial-in-pool*.*.isp.net), and thus should not be allowed to connect
to an inbound SMTP server (depending on the site's policy).

This test would be similar to the header test:

if network :is "ipaddr" "192.168.10.4"
   {
      keep; # if our IP address is the same as 192.168.10.4
   }

if network :contains "ipaddr" "192.168.10.0/24"
   {
      keep; # if our IP address falls in the 192.168.10.0/24 network
   }

if network :contains "hostname" "evil.com"
   {
      discard; # for all hosts in the evil.com domain.
   }

if network :is "helo" "www.hotmail.com"
   {
      discard; # for all forged HELO strings using www.hotmail.com
   }

Although I haven't fully thought this through, I could envision a
possible RBL extension to look like:

if network :contains "ipaddr" "rbl"
   {
      fileinto "spam"; # if this IP address is in the RBL.
   }

The sieve implementation would know how to contact an RBL server. 
Typically, the value of the TXT record could be tossed.

The ability to filter messages based on their origin (or supposed
origin) would allow for powerful spam filtering techniques. Please let
me know if this sounds useful. I can write this up more formally, if
there is any interest.

Steve

-- 
Steve Simitzis : [email-masked] || [email-masked] : "Hup!" - R.Crumb
 \ simitzis /sim' - i - jees/ (n) an unpronounceable string of random letters /
    \ Critical Path : saturn5 Productions : hath the daemon spawn no fire? /
       \ operators are standing by : 415-282-9979 (h) 415-808-8725 (w) /

From: Steve Hole <[email-masked]>
Date: Tue, 16 Feb 1999 21:36:33 -0700
To: Tim Showalter <[email-masked]>
Subject: Re: Feedback on the document structure
Cc: [email-masked]
Sender: [email-masked]

On 11 Feb 1999 13:10:36 -0500 Tim Showalter <[email-masked]> wrote:

> > sec 2.9.  Evaluation
> > 
> > This section needs to be expanded to include:
> >  - evaluation ordering
> >  - control issues
> >  - command argument processing
> >  - evaluation results ie.  what happens when you evaluate a control 
> > command vs. a test command vs. an action.
> 
> I am not sure what you want.  Could you be more specific?  I thought all 
> of this stuff was mostly obvious, I guess.

Oh sure, ask a hard question.   

I really can't remember what this was about specifically.   I think that I
was looking for an explicit discussion on the ordering of evaluation of the
language.   Ie. each line is evaluated in order, top to bottom.   Is the 
entire script parsed before evaluation or can you parse a line at a time 
(I know the answer).

Please excuse the obvious onset of senility.   Bottom line is that if I 
can't remember then it can't have been that important.    I'l see if it 
comes back to me when I reread the new text.

Cheers.
---  
Steve Hole                           
Execmail Inc.
Mailto:[email-masked] 
Phone: 780-424-4922

From: Steve Hole <[email-masked]>
Date: Tue, 16 Feb 1999 21:23:33 -0700
To: Tim Showalter <[email-masked]>
Subject: Re: Feedback on the document structure
Cc: [email-masked]
Sender: [email-masked]

On 11 Feb 1999 13:43:05 -0500 Tim Showalter <[email-masked]> wrote:

> I've reworked the sections on arguments, put them all in one place,
> better described positional arguments, and described optional arguments
> as tagged arguments that can be left out.  The text from the nroff
> source is this.

This is much better.    The analogy to the Unix command line stuff did the
trick for me.     The discussion on the benefit of the ":" tagging helps 
alot when thinking about a flexible parser that can accept extensions.

Cheers.

---  
Steve Hole                           
Execmail Inc.
Mailto:[email-masked] 
Phone: 780-424-4922

Date: 16 Feb 1999 20:07:40 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: reject imples stop?
Sender: [email-masked]

> Date: Tue, 16 Feb 1999 17:02:40 -0800
> From: "J.D. Falk" <[email-masked]>
> 
> On 02/16/99, Tim Showalter <[email-masked]> wrote: 
> 
> > Should a reject imply a stop?  If reject is incompatible with all other
> > actions, this is a very reasonable behavior.
> > 
> > If first-action-encountered wins, what happens when you fileinto, then
> > reject?
> 
> 	I think it should just be filed and then rejected.  This is
> 	something I've seen implemented from time to time for tracking
> 	purposes -- with the various new anti-spam laws on the books,
> 	it seems likely that there'll be more need for such things, as
> 	well as merely fileinto and discard.

I have moral problems with a specification that says reject and a
fileinto are not incompatible.  While I know implementations will
(sometimes) implement this anyway, as an administrator I do not want to
present the ability to users to make my mail servers lie.

Tim

Date: Tue, 16 Feb 1999 17:02:40 -0800
From: "J.D. Falk" <[email-masked]>
To: Tim Showalter <[email-masked]>, [email-masked]
Subject: Re: reject imples stop?
Sender: [email-masked]

On 02/16/99, Tim Showalter <[email-masked]> wrote: 

> Should a reject imply a stop?  If reject is incompatible with all other
> actions, this is a very reasonable behavior.
> 
> If first-action-encountered wins, what happens when you fileinto, then
> reject?

	I think it should just be filed and then rejected.  This is
	something I've seen implemented from time to time for tracking
	purposes -- with the various new anti-spam laws on the books,
	it seems likely that there'll be more need for such things, as
	well as merely fileinto and discard.

-- 
J.D. Falk <[email-masked]>                     Got clue?  http://www.ispf.com/
Special Agent In Charge (Abuse Issues)
Critical Path, Inc.

Date: Tue, 16 Feb 1999 16:10:58 -0800
From: "J.D. Falk" <[email-masked]>
To: Michael Salmon <[email-masked]>, [email-masked]
Subject: Re: sieve-06bis
Sender: [email-masked]

On 02/16/99, Michael Salmon <[email-masked]> wrote: 

> | In order to prevent mail loops, an implementation MUST refuse to
> | filter a message that it has already filtered once; that is, a
> | message must not pass through a given server twice.
> 
> This seems excessive to me, especially as servers are becoming larger 
> and larger all the time. I think that mail loops would be prevented if 
> a message could only be kept or discarded when it had been seen twice 
> by the same user.

	I don't think this RFC is the place to specify how to stop
	mail loops, except insofar as "an implementation SHOULD be
	smart enough to prevent looping of messages."  A seperate
	"Best Current Practice" draft would be more appropriate,
	and I'd love to work with somebody on that.

-- 
J.D. Falk <[email-masked]>                     Got clue?  http://www.ispf.com/
Special Agent In Charge (Abuse Issues)
Critical Path, Inc.

Date: Tue, 16 Feb 1999 19:11:30 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: I-D Deadline Approaching
Sender: [email-masked]

At 06:07 PM 2/16/99 -0500, Tim Showalter wrote:
>Hi.  The Internet-Drafts deadline is February 26.  This leaves ten days
>to get whatever we want to get done to Sieve done.

Few more corrections, but its getting there...

   Example:  if header :contains ["From"] ["coyote"] {
                redirect "[email-masked]";
             } elsif header "Subject" :contains "$$$" {
                            ^^^^^^^^^^^^^^^^^^^ syntax, :contains "Subject"
                redirect "[email-masked]";

...
   Example:  if not :exists ["From","Date"] {
                    ^^^^^^^ syntax, exists
                discard;
             }

Date: 16 Feb 1999 18:07:36 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: I-D Deadline Approaching
Sender: [email-masked]

--Multipart_Tue_Feb_16_18:07:36_1999-1
Content-Type: text/plain; charset=US-ASCII

Hi.  The Internet-Drafts deadline is February 26.  This leaves ten days
to get whatever we want to get done to Sieve done.

I'm attaching my current copy of Sieve, along with the current vacation
draft.  I will probably run ispell over them before submitting them and
may try to clean up a couple other things, but otherwise, I will submit
them to the I-D editor THIS FRIDAY, the 19th, for publication.  Barring
major mistakes, that will be the only submission I make before this
IETF.

Please read through them and let me know what we haven't covered, and
what needs to be fixed.

Here is a partial list of recent changes that come to mind:

 * Multiple fileinto is ALLOWED.
 * Implicit keep happens only when no fileinto, discard, redirect, or
   explicit keep happens.
 * Some actions are mutually exclusive (reject and everything).
   This makes a run-time error.
 * Implementations SHOULD only write one copy of a message to a mailbox.
   This is defined in a very vague way.
 * Tagged arguments go at the front of commands, never in the middle.
 * Charset for a vacation reply can NOT be specified.
 * Subject line and additional headers for a vacation reply can NOT be
   specified.
 * Grammar is written using a tokenizing approach instead of the
   previous approach cleaning up some ambiguities.
 * Except where I questioned them, I took most of the changes posted to
   the mailing list recently, including some suggested examples and
   Tony's proposed text for section 7, all of which have been added to
   the draft.

Please let me know if this is what you want.

Drafts are attached below, subject to the MIME-warping whims of my
mailer.  In absence of comments, I'll submit these as versions sieve-07
and sieve-vacation-01.

Thanks very much.

--Multipart_Tue_Feb_16_18:07:36_1999-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="sieve.txt"
Content-Transfer-Encoding: 7bit

Network Working Group                                       T. Showalter
Internet Draft: Sieve                                    Carnegie Mellon
Document: draft-showalter-sieve-06bis.txt              February 16, 1999
Expire in six months

                    Sieve: A Mail Filtering Language

Status of this memo

   This document is an Internet-Draft and is in full conformance with
   all provisions of Section 10 of RFC2026.

   Internet-Drafts are working documents of the Internet Engineering
   Task Force (IETF), its areas, and its working groups.  Note that
   other groups may also distribute working documents as Internet-
   Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet- Drafts as reference
   material or to cite them other than as "work in progress."

   The list of current Internet-Drafts can be accessed at
   http://www.ietf.org/ietf/1id-abstracts.txt

   The list of Internet-Draft Shadow Directories can be accessed at
   http://www.ietf.org/shadow.html.

   The protocol discussed in this document is experimental and subject
   to change.  Persons planning on either implementing or using this
   protocol are STRONGLY URGED to get in touch with the author before
   embarking on such a project.

Copyright Notice

   Copyright (C) The Internet Society 1999.  All Rights Reserved.

Abstract

   This document describes a mail filtering language for filtering
   messages at time of final delivery.  It is designed to be independent
   of protocol, and implementable on either a mail client or mail
   server.  It is meant to be extensible, simple, and independent of
   access protocol, mail architecture, and operating system.  It is
   suitable for running on a mail server where users may not be allowed
   to execute arbitrary programs, such as on black box IMAP servers, as

Showalter                 Expire in Six Months                  [Page 1]

Internet DRAFT                   Sieve                 February 16, 1999

                           Table of Contents

Status of this memo ...............................................    1
Copyright Notice ..................................................    1
Abstract ..........................................................    1
0.      Meta-information on this draft ............................    4
0.1.     Discussion ...............................................    4
0.2.     Known Problems ...........................................    4
0.2.1.   Probable Extensions ......................................    4
0.2.2.   Known Bugs ...............................................    4
0.3.     Noted Changes ............................................    5
0.3.1.   since -06 ................................................    5
0.3.2.   since -05 ................................................    5
0.3.3.   since -04 ................................................    6
1.      Introduction ..............................................    8
1.1.     Conventions Used in This Document ........................    8
1.2.     Example mail messages ....................................    9
2.      Design ....................................................   10
2.1.     Form of the Language .....................................   10
2.2.     Whitespace ...............................................   10
2.3.     Comments .................................................   10
2.4.     Literal Data .............................................   11
2.4.1.   Numbers ..................................................   11
2.4.2.   Strings ..................................................   11
2.4.2.1. String Lists .............................................   12
2.4.2.2. Headers ..................................................   12
2.4.2.3. Addresses ................................................   12
2.5.     Tests ....................................................   13
2.5.1.   Test Lists ...............................................   13
2.6.     Arguments ................................................   13
2.6.1.   Positional Arguments .....................................   13
2.6.2.   Tagged Arguments .........................................   13
2.6.3.   Optional Arguments .......................................   14
2.6.4.   Types of Arguments .......................................   14
2.7.     String Comparison ........................................   14
2.7.1.   Match Type ...............................................   15
2.7.2.   Comparisons across Character Sets ........................   16
2.7.3.   Comparators ..............................................   16
2.7.4.   Comparisons against addresses ............................   17
2.8.     Blocks ...................................................   17
2.9.     Commands .................................................   18
2.10.    Evaluation ...............................................   18
2.10.1.  Mutually Exclusive Delivery Actions ......................   18

Showalter                 Expire in Six Months                  [Page 2]

Internet DRAFT                   Sieve                 February 16, 1999

2.10.2.  Implicit Keep ............................................   18
2.10.3.  Message Uniqueness in a Mailbox ..........................   19
2.10.4.  Limits on Numbers of Actions .............................   19
2.10.5.  Extensions and Optional Features .........................   19
3.      Control Commands ..........................................   20
4.      Action Commands ...........................................   21
4.1.     Action reject ............................................   21
4.2.     Action fileinto ..........................................   22
4.3.     Action redirect ..........................................   22
4.4.     Action keep ..............................................   23
4.5.     Action stop ..............................................   23
4.6.     Action discard ...........................................   23
4.7.     Action require ...........................................   24
5.      Test Commands .............................................   24
5.1.     Test address .............................................   24
5.2.     Test allof ...............................................   25
5.3.     Test anyof ...............................................   25
5.4.     Test envelope ............................................   25
5.5.     Test exists ..............................................   26
5.6.     Test false ...............................................   26
5.7.     Test header ..............................................   27
5.8.     Test not .................................................   27
5.9.     Test size ................................................   27
6.      Extensibility .............................................   28
6.1.     Capability String ........................................   28
6.2.     Registry .................................................   29
6.3.     Capability Transport .....................................   29
7.      Transmission ..............................................   29
9.      Parsing ...................................................   30
9.1.     Lexical Tokens ...........................................   30
9.2.     Grammar ..................................................   31
9.      Security Considerations ...................................   32
10.     Acknowledgments ...........................................   32
11.     Author's Address ..........................................   32
Appendix A.  References ...........................................   33
Appendix B.  Full Copyright Statement .............................   33

Showalter                 Expire in Six Months                  [Page 3]

Internet DRAFT                   Sieve                 February 16, 1999

   it has no variables, loops, or ability to shell out to external
   programs.

Showalter                 Expire in Six Months                  [Page 2]

Internet DRAFT                   Sieve                 February 16, 1999

0.      Meta-information on this draft

   This information is intended to facilitate discussion.  It will be
   removed when this document leaves the Internet-Draft stage.

0.1.     Discussion

   This draft is being discussed on the MTA Filters mailing list at
   <[email-masked]>.  Subscription requests can be sent to
   <[email-masked]> (send an email message with the
   word "subscribe" in the body).  More information on the mailing list
   along with a WWW archive of back messages is available at
   <http://www.imc.org/ietf-mta-filters/>.

0.2.     Known Problems

0.2.1.   Probable Extensions

   The following suggestions have been made, and will probably be
   addressed by extensions.

   An extension for regular expressions will be written.  While regular
   expressions are of questionable utility for most users, the
   programmers writing implementations desperately want regular
   expressions.

   "Detailed" addressing or "sub-addressing" (i.e., the "foo" in an
   address "[email-masked]") is not handled, and will be moved
   to an extension for those systems that offer it.

   A vacation command has been requested for an extension; a preliminary
   draft exists and will be submitted to the internet-drafts repository.
   Vacation functionality is isn't in the draft because having vacation
   assumes you can store the addresses of people who have already
   received vacation notifications, which isn't always the case.

   A suggestion was made to set IMAP flags on delivery (e.g., \Flagged,
   \Deleted, \Answered, \Seen).

   An "include" command is not included, but has been suggested for an
   extension.

0.2.2.   Known Bugs

   I have punted on multiple fileinto.

   The title of 2.10.1 is probably open for suggestions.  Given the
   existance of DSNs and the similarity of names, I'm not happy with it.

Showalter                 Expire in Six Months                  [Page 4]

Internet DRAFT                   Sieve                 February 16, 1999

0.3.     Noted Changes

0.3.1.   since -06

   Larry Greenfield supplied a rewrite of the grammar that seperates
   things out into a tokenizer and a parser.  This grammar also allows
   UTF-8 characters in strings (previous versions limited characters to
   the 0x01-0x7F range).

   Steve Hole made a number of editorial suggestions that were taken.
   This includes discussing a tokenizer in 2.1 and renaming sections 3,
   4, and 5 ("Control Structures" became "Control Commands", "Actions"
   became "Action Commands", and "Tests" became "Test Commands").  Other
   uses of these terms in this document should have been changed to
   match, but I probably missed some.

   Lots of new rules were added to section 2.10, and should be reviewed
   carefully.  I hope that they reflect consensus, but am not sure.
   None of these are probably the changes that Steve Hole were asking
   for, but I thought that section was the appropriate place for them
   anyway.

   Tokens are defined as being case insensitive.

   The copyright date has been fixed and the copyright and I-D
   boilerplate updated with the latest and greatest from the IETF web
   site.

   Acknowledgements were moved further towards the end.

   Several other more minor fixes were made.

0.3.2.   since -05

   Draft -05 was never published in the Internet-Drafts repository, but
   was circulated on the [email-masked] mailing list.

   All nits submitted by Greg Sereda are hopefully addressed.  Most of
   these were example bugs, but he also pointed out that types for
   arguments were under-specified and in several cases orders of
   arguments disagreed with the syntax.

   "Match keyword" was changed to "match type" as an editorial change.

   "Forward" was renamed to "redirect" because of the conflict between
   mutliple meanings of "forward" in order to make it clear exactly what
   we meant.

Showalter                 Expire in Six Months                  [Page 5]

Internet DRAFT                   Sieve                 February 16, 1999

   Limitation of one redirect per message should be removed.

   The types of arguments have been added to their syntax line.

   Added "require" back in a slightly different form.  "Require" is now
   an action (arbitrarily) and has been added to sec. 2.10 as well.

   Implementations are responsible for not allowing mail loops.

   All discussion of short-circuit evaluation has been removed.  On a
   related note, tests must not have side effects.

   Envelope is required to drop source routes.

   An address-matching primitive has been added.

0.3.3.   since -04

   Here are a list of changes from draft 04.  (It may not be complete.)

   * Concensus: i;ascii-casemap is required.

   * Consensus: i;ascii-casemap is the default.

   * Header name compares are always case-insensitive; the draft now
     says so.

   * Several examples were fixed, but it is likely that errors remain.

   * Bug: Section 7, remove reference to "support".

   * There are two namespaces  for extension names, one "vnd.", one
     everything else, like MIME.

   * All XXXs have been removed, except for in IANA section.

   * Fileinto is optional, and discussion of local mail folders and POP3
     has been removed.

   * A non-present comparator is considered to be basically a syntax
     error.

   * Resent headers are not to be added by the "redirect" command.

   * Tagged arguments must follow the keyword, and may not be
     interspersed with positional arguments.

   * Envelope-matching commands are to be added with the syntax that

Showalter                 Expire in Six Months                  [Page 6]

Internet DRAFT                   Sieve                 February 16, 1999

     Barry suggested.

   * Put back :matches match type.

   * What happens when an error occurs has been dropped.

   * Reject is now optional.

   * Implementations are encouraged to decode header charsets, and if
     they don't, are required to not do compares on 8-bit data.

Showalter                 Expire in Six Months                  [Page 7]

Internet DRAFT                   Sieve                 February 16, 1999

1.      Introduction

   This memo documents a language that can be used to create filters for
   electronic mail. It is not tied to any particular operating system or
   mail architecture.  It requires the use of [IMAIL]-compliant
   messages, but otherwise should generalize to other systems that meet
   these criteria.

   The language is powerful enough to be useful, but limited in power in
   order to allow for a safe server-side filtering system.  The
   intention is to make it impossible for users to do anything more
   complex (and dangerous) than write simple mail filters, along with
   facilitating GUI-based editors. The language is not Turing-complete,
   and provides no way to write a loop or a function.  Variables are not
   provided.

   Implementations of the language are expected to take place at time of
   final delivery, when the message is moved to the user-accessible
   mailbox.  In systems where the MTA does final delivery, such as
   traditional UNIX mail, it is reasonable to sort when the MTA deposits
   mail into the user's mailbox.

   There are a number of reasons to use a filtering system.  Mail
   traffic for most users has been increasing due both to increased
   usage of e-mail, the emergence of unsolicited email as a form of
   advertising, and increased usage of mailing lists.

   Experience at Carnegie Mellon has shown that if a filtering system is
   made available to users, many will make use of it in order to file
   messages from specific users or mailing lists.  However, many others
   did not make use of the Andrew system's FLAMES [FLAMES] filtering
   language due to difficulty in setting it up.

   Because of the expectation that users will make use of filtering if
   it is offered and easy to use, this language has been made simple
   enough to allow many users to make use of it, but rich enough that it
   can be used productively.  However, it is expected that GUI-based
   editors will be the preferred way of editing filters for a large
   number of users.

1.1.     Conventions Used in This Document

   In the sections of this document that discuss the requirements of
   various keywords and operators, the following conventions have been
   adopted.

   The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "CAN", and
   "MAY" in this document are to be interpreted as defined in

Showalter                 Expire in Six Months                  [Page 8]

Internet DRAFT                   Sieve                 February 16, 1999

   [KEYWORDS].

   Each section on a test, action, or control structure has a line
   labeled "Syntax:".  This line describes the syntax of the command,
   including its name and its arguments.  Required arguments are listed
   inside angle brackets ("<" and ">").  Optional arguments are listed
   inside square brackets ("[" and "]").  Each argument is followed by
   its type, so "<key: string>" represents an argument called "key" that
   is a string.  Literal strings are represented with double-quoted
   strings.  Alternatives are seperated with slashes, and parenthesis
   are used for grouping, similar to [ABNF].

   In the "Syntax" line, there are three special pieces of syntax that
   are frequently repeated, MATCH-TYPE, COMPARATOR, and ADDRESS-PART.
   These are discussed in sections 2.7.1, 2.7.3, and 2.7.4,
   respectively.

   The formal grammar for these commands in section 10 and is the
   authoritative reference on how to construct commands, but the formal
   grammar does not specify the order, semantics, number or types of
   arguments to commands, nor the legal command names.  The intent is to
   allow for extension without changing the grammar.

1.2.     Example mail messages

   The following mail messages will be used throughout this document  in
   examples.

   Message A
   -----------------------------------------------------------
   Date: Tue, 1 Apr 1997 09:06:31 -0800 (PST)
   From: [email-masked]
   To: [email-masked]
   Subject: I have a present for you

   Look, I'm sorry about the whole anvil thing, and I really
   didn't mean to try and drop it on you from the top of the
   cliff.  I want to try to make it up to you.  I've got some
   great birdseed over here at my place--top of the line
   stuff--and if you come by, I'll have it all wrapped up
   for you.  I'm really sorry for all the problems I've caused
   for you over the years, but I know we can work this out.
   --
   Wile E. Coyote       "Super Genius"        [email-masked]
   -----------------------------------------------------------

Showalter                 Expire in Six Months                  [Page 9]

Internet DRAFT                   Sieve                 February 16, 1999

   Message B
   -----------------------------------------------------------
   From: youcouldberich!@reply-by-postal-mail
   Sender: [email-masked]
   To: [email-masked]
   Date:  Mon, 31 Mar 1997 18:26:10 -0800 (PST)
   Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$

   YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
   IT!  SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS!  IT WILL
   GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
   MONEY! MONEY! COLD HARD CASH!  YOU WILL RECEIVE OVER
   $20,000 IN LESS THAN TWO MONTHS!  AND IT'S LEGAL!!!!!!!!!
   !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1  JUST
   SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
   -----------------------------------------------------------

2.      Design

2.1.     Form of the Language

   The language consists of a set of commands.   Each command consists
   of a set of tokens delimited by whitespace.   The first token is the
   command string followed by zero or more arguments.  Arguments may be
   literal data, tags, blocks of commands, or test commands.

   The language is represented in UTF-8, as specified in [UTF-8].

   Tokens in the ASCII range are considered case-insensitive.

2.2.     Whitespace

   Whitespace is used to separate tokens.  Whitespace is made up of
   tabs, newlines (CRLF, never just CR or LF), and the space character.
   The amount of whitespace used is not significant.

2.3.     Comments

   Comments begin with a "#" character that is not contained within a
   string and continue until the next CRLF.  Comments are semantically
   equivalent to whitespace and are permitted to be used anyplace that
   whitespace is (with one exception in multi-line strings).

   Example:  if size :over 100K { # this is a comment
                discard;
             }

Showalter                 Expire in Six Months                 [Page 10]

Internet DRAFT                   Sieve                 February 16, 1999

2.4.     Literal Data

   Literal data means data that is not executed, merely evaluated "as
   is", to be used as arguments to commands.  Literal data is limited to
   numbers and strings.

2.4.1.   Numbers

   Numbers are given as ordinary decimal numbers.  However, those
   numbers that have a tendency to be fairly large, such as message
   sizes, MAY have a "K", "M", or "G" appended to indicate a multiple of
   a base-two number.  To be comparable with the power-of-two-based
   versions of SI units that computers frequently use, K specifies kilo,
   or 1,024 (2^10) times the value of the number; M specifies mega, or
   1,048,576 (2^20) times the value of the number; and G specifies giga,
   or 1,073,741,824 (2^30) times the value of the number.

   Implementations MUST provide 31 bits of magnitude in numbers, but may
   provide more.

   Negative, fractional, and decimal numbers are not permitted  by  this
   specification.

2.4.2.   Strings

   Scripts involve large numbers of strings, as they are used for
   pattern matching, addresses, and textual bodies, etc.  Typically,
   short quoted strings suffice for most uses, but a more convenient
   form is provided for longer strings such as bodies of messages.

   A quoted string starts and ends with a single double quote (the <">
   character, ASCII 34).  A backslash ("\", ASCII 92) inside of a quoted
   string is followed by either another backslash or a double quote.
   This two-character sequence represents a single backslash or double-
   quote within the string, respectively.

   Other escape sequences may be permitted depending on context.  An
   undefined escape sequence (such as "\a" in a context where "a" has no
   special meaning) is interpreted as if there were no backslash (in
   this case, "\a" is just "a").

   Non-printing characters such as tabs, CR and LF, and control
   characters are permitted in strings.  NUL (ASCII 0) is not allowed in
   strings.

   For entering larger amounts of text, such as an email message, a
   multi-line form is allowed.  It starts with the keyword "text:",
   followed by a CRLF, and ends with the sequence of a CRLF, a single

Showalter                 Expire in Six Months                 [Page 11]

Internet DRAFT                   Sieve                 February 16, 1999

   period, and another CRLF.  In order to allow the message to begin
   lines with a single-dot, lines are dot-stuffed.  That is, when
   composing a message body, an extra `.' is added before each line
   which begins with a `.'.  When the server interprets the script,
   these extra dots are removed.

   Note that a comment or whitespace may occur in between the "text:"
   and the CRLF, but not within the string itself.

2.4.2.1. String Lists

   When matching patterns, strings frequently come in groups.  For this
   reason, a list of strings is allowed in many tests, implying that if
   the test is true using any one of the strings, then the test is true.
   Implementations are encouraged to use short-circuit evaluation in
   these cases.

   For instance, the test `header :contains ["To", "Cc"]
   ["[email-masked]", "[email-masked]"]' is true if either the
   To header or Cc header of the input message contains either of the
   e-mail addresses "[email-masked]" or "[email-masked]".

   Conversely, in any case where a list of strings would be appropriate,
   a single string is allowed without being a member of a list; it is
   equivalent to a list with a single member.  So the test `exists "To"'
   is equivalent to the test `exists ["To"]'.

2.4.2.2. Headers

   Headers are a subset of strings.  In the Internet Message
   Specification [IMAIL], each header line is allowed to have whitespace
   nearly anywhere in the line, including after the field name and
   before the subsequent colon.  Extra spaces between the header name
   and the ":" in a header field are ignored by the interpreter.

   A header name never contains a colon.  The "From" header refers to a
   line beginning "From:" (or "From   :", etc.).  No header will match
   the string "From:" due to the trailing colon.

2.4.2.3. Addresses

   A number of commands call for email addresses, which are also a
   subset of strings.  These addresses must be compliant with [IMAIL].
   Implementations MUST ensure that the addresses are syntactically
   valid, but need not ensure that they are actually deliverable.

Showalter                 Expire in Six Months                 [Page 12]

Internet DRAFT                   Sieve                 February 16, 1999

2.5.     Tests

   Tests are given as arguments to commands in order to control how the
   run.  Generally, a test is used to decide if a block of code should
   be evaluated.

   Tests MUST NOT have side effects.  That is, a test must not make
   changes to state.  No tests in this specification have side effects,
   and side effects are forbidden in extensions as well.

   Note:  Tests with side effects impair readability and maintainability
          and are difficult to represent in a graphic interface to
          generating scripts, so side effects have been confined to
          actions where they are clearer.

2.5.1.   Test Lists

   Some tests (allof and anyof, which implement logical and and or,
   respectively) need to take more than a single test as an argument.
   The test-list syntax element provides a way of grouping tests.

   Example:  if anyof (not exists ["From", "Date"],
                   header :contains "from" "[email-masked]") {
                discard;
             }

2.6.     Arguments

   In order to specify how they function, most commands take arguments.
   There are three types of arguments: positional, tagged, and optional.

2.6.1.   Positional Arguments

   Positional arguments are given to a command which discerns their
   meaning based on their order.  When a command takes positional
   arguments, all positional arguments must be supplied, and must be in
   the order prescribed.

2.6.2.   Tagged Arguments

   This document provides for tagged arguments in the style of
   CommonLISP.  These are also similar to flags given to commands in
   most command-line systems.

   A tagged argument is an an argument for a command that begins with
   ":", and consists of a tag naming the argument, such as ":contains".
   This argument means that zero or more of the next tokens have some

Showalter                 Expire in Six Months                 [Page 13]

Internet DRAFT                   Sieve                 February 16, 1999

   particular meaning, depending on the argument.  These next tokens may
   be numbers or strings, but are never blocks.

   So tagged arguments are similar to positional arguments, except that
   instead of the meaning being derived from the command, it is derived
   from the tag.

   Tagged arguments must appear before positional arguments, but they
   may appear in any order.  For convienence, this is not expressed in
   the syntax definitions with commands, but they still may be reordered
   arbitrarily provided they appear before positional arguments.  Tagged
   arguments may be mixed with optional arguments.

   To keep the language simple, tagged arguments should not take tagged
   arguments as arguments.

2.6.3.   Optional Arguments

   Optional arguments are exactly like tagged arguments except that they
   may be left out, in which case a default value is implied.  Because
   optional arguments tend to result in shorter scripts, they have been
   used far more than tagged arguments.

   One particularly noteworthy case is the ":comparator" argument, which
   allows the user to specify which ACAP comparator will be used to
   compare two strings, since different languages may impose different
   orderings on UTF-8 [UTF-8] characters.

2.6.4.   Types of Arguments

   Abstractly, arguments may be literal data, tests, or blocks of
   commands.  In this way, an "if" control structure is merely a command
   that happens to take a test and a block as arguments and may execute
   the block of code.

   However, this abstraction is ambiguous from a parsing standpoint.
   The grammar in section 9.2 presents a parsable version of this:
   arguments are string-lists, numbers, and tags, which may be followed
   by a test or a test-list, which may be followed by a block of
   commands.  No more than one test or test list, nor more than one
   block of commands, may be used, and commands that end with blocks of
   commands do not end with semicolons.

2.7.     String Comparison

   When matching one string against another, there are a number of ways
   of performing the match.  These are accomplished with three types of
   matches:  exact match, a substring match, and a wildcard glob-style

Showalter                 Expire in Six Months                 [Page 14]

Internet DRAFT                   Sieve                 February 16, 1999

   match.  In order to provide for matches between character sets and
   case insensitivity, Sieve borrows ACAP's comparator registry.

   However, when a string is being used to represent the name of a
   header, the comparator is never user-specified.  Header comparisons
   are always done in a case-insensitive manner, since this is the way
   things are specified in the message specification [IMAIL].  That is,
   header-name comparisons are always done with the "i;ascii-casemap"
   comparator.

2.7.1.   Match Type

   There are three allowed match types describing the allowed match in
   this draft: they are ":is", ":contains", and ":matches".  Match type
   are supplied to those commands which allow them to specify whether
   the match is to be a complete match or not.

   These are used as tagged arguments to tests that perform string
   comparison.  Exactly one of them is necessary for a command.

   The ":contains" version describes a substring match.  If the value
   argument contains the key argument as a substring, the match is true.
   For instance, the string "frobnitzm" contains "frob" and "nit", but
   not "fbm".  The null key ("") is contained in all values.

   The ":is" version describes an absolute match; if the contents of the
   first string are absolutely the same as the contents of the second
   string, they match.  Only the string "frobnitzm" is the string
   "frobnitzm".  The null key only ":is" the null value.

   The ":matches" version specifies a wildcard match using the
   characters "*" and "?".  "*" matches any number of characters, and
   "?" matches a single character.  "?" and "*" may be escaped as "\?"
   and "\*" in strings to match against them by name.

   In order to specify  what  type  of  match  is  supposed  to  happen,
   commands   that  support  matching  take  optional  tagged  arguments
   ":matches", ":is", and ":contains".  Commands default to using  ":is"
   matching.   Note  that these modifiers may interact with comparators;
   in particular, some comparators are not suitable  for  matching  with
   ":contains"  or  ":matches".  It is an error to use a comparator with
   ":contains" or ":matches" that is not compatible with it.

   For convienence, the MATCH-TYPE syntax element  is  defined  here  as
   follows:

   Syntax:   [ < ":is" / ":contains" / ":matches" > ]

Showalter                 Expire in Six Months                 [Page 15]

Internet DRAFT                   Sieve                 February 16, 1999

2.7.2.   Comparisons across Character Sets

   All Sieve scripts are represented in UTF-8, but messages may involve
   a number of character sets.  In order for comparisons to work across
   character sets, implementations SHOULD implement the following
   behavior:

      Implementations decode header charsets to UTF-8.  Two strings are
      considered equal if their UTF-8 representations are identical.
      Implementations should decode charsets represented in the forms
      specified by [MIME] for both message headers and bodies.
      Implementations must be capable of decoding US-ASCII, ISO-8859-1,
      the ASCII subset of ISO-8859-* character sets, and UTF-8.

   If implementations fail to support the above behavior, they MUST
   conform to the following:

      No two strings can be considered equal if one contains data
      greater than 127.

2.7.3.   Comparators

   In order to allow for character set-independent matches, the match
   type may be coupled with a comparator name.  Comparators are
   described for [ACAP]; a registry is defined for ACAP, and this
   specification uses that registry.

   ACAP defines multiple comparator types.  Only equality types are used
   in this specification.

   All implementations MUST support the "i;octet" comparator (simply
   compares octets) and the "i;ascii-casemap" comparator (which treats
   uppercase and lowercase English characters as the same).  If left
   unspecified, the default is "i;ascii-casemap".

   Some comparators may not be usable with substring matches; that is,
   they may only work with ":is".  It is an error to try and use a
   comparator with ":matches" or ":contains" that is not compatible with
   it.

   A comparator is specified with commands that support matching by the
   ":comparator" option.  This option is followed by a string providing
   the name of the comparator to be used.  For convienence, the syntax
   of a comparator is abbreviated to [COMPARATOR], and (repeated in
   several tests) is as follows:

   Syntax:   [ ":comparator" <comparator-name: string> ]

Showalter                 Expire in Six Months                 [Page 16]

Internet DRAFT                   Sieve                 February 16, 1999

   So in this example,

   Example:  if header :contains :comparator "i;octet" "Subject"
                "MAKE MONEY FAST" {
                   discard;
                }

   would discard any message with subjects like "You can MAKE MONEY
   FAST", but not "You can Make Money Fast", since the comparator used
   is not case-sensitive.

   If a comparator is not known to an implementation, it is treated in
   the same way as an unknown command or syntax error.

   Both ":matches" and ":contains" match type are compatible with the
   "i;octet" and "i;ascii-casemap" comparators and may be used with
   them.

2.7.4.   Comparisons against addresses

   Addresses are probably one of the most frequent representations as
   strings.  Because these are structured and being able to compare
   against the local-part or the domain of an address is useful, some
   tests that act exclusively on addresses take an additional optional
   argument that specifies what the test acts on.

   These optional arguments are ":localpart", ":domain", and ":all",
   which act on the local-part (left-side), the domain part (right-
   side), and the whole address.

   The kind of comparison is done, such as whether or not the comparison
   done is case-insensitive, is specified as a comparator argument to
   the test.

   For convienence, the ADDRESS-PART syntax element is defined here as
   follows:

   Syntax:   < ":localpart" / ":domain" / ":all" >

2.8.     Blocks

   Blocks are sets of commands enclosed within curly braces.  Blocks are
   supplied to commands so that the commands can implement control
   commands.

   So a control structure is just a command that happens to take a test

Showalter                 Expire in Six Months                 [Page 17]

Internet DRAFT                   Sieve                 February 16, 1999

   and a block as its arguments; depending on the result of the control
   structure, it runs the code in the block zero or more times.  (Note
   that by the commands supplied in the specification, there are no
   loops, so the control structures supplied--if, elsif, and else--run a
   block either once or not at all.)

2.9.     Commands

   Sieve scripts are sequences of commands.  Commands can take any of
   the tokens above as arguments, and arguments may be either tagged or
   positional arguments.

   There are three kinds of commands, test commands, action commands,
   and control commands.

   The simplest is an action command.  An action command is an
   identifier followed by zero or more arguments, terminated by a
   semicolon.  Action commands do not take tests or blocks as arguments.

   A control command is similar, but it takes a test as an argument, and
   ends with a block instead of a semicolon.

   A test command is used as part of a control command.  It is used to
   specify whether or not the block of code given to the control command
   is executed.

2.10.    Evaluation

2.10.1.  Mutually Exclusive Delivery Actions

   Actions that do not affect delivery status can be used multiple times
   and in any combination with each other.  In the base draft, these
   actions are "fileinto" and "redirect".

   Only one action that affects delivery status may be taken.  An
   attempt to run more than one such action leads to a run-time error,
   which has undefined behavior.  In the base draft, these actions are
   "keep", "discard", and "reject".

2.10.2.  Implicit Keep

   Previous experience with filtering systems suggests that cases tend
   to be missed in scripts.  To prevent massive errors, Sieve has an
   "implicit keep".

   An implicit keep is performed if a message is not written to a
   mailbox, redirected to a new address, or explicitally thrown out.
   That is, if a fileinto, a keep, a redirect, or a discard is

Showalter                 Expire in Six Months                 [Page 18]

Internet DRAFT                   Sieve                 February 16, 1999

   performed, an implicit keep is not.

   For instance, with any of the short messages offered above, the
   following script produces no actions.

   Example:  if size :over 500K { discard; }

   As a result, the implicit keep would be taken.

2.10.3.  Message Uniqueness in a Mailbox

   Implementations SHOULD NOT write a message to a mailbox where a copy
   of it already exists, even if a script explicitly asks for a message
   to be written to a mailbox twice.

   The test for equality of two messages is not defined by this memo.

2.10.4.  Limits on Numbers of Actions

   Site policy may limit numbers of actions taken.  In the event that a
   policy limits the number of actions taken on a particular message,
   the actions that are generated first in a script should be followed.

2.10.5.  Extensions and Optional Features

   Because of the differing capabilities of many mail systems, several
   features of this specification have been specified as optional.
   Before any of these extensions can be used, they must be declared
   with the "require" action.

   If an extension is not enabled with "require", implementations MUST
   treat it as if they did not support it at all.

   If a script does not understand an extension declared with require,
   the script must not be used at all.

   Note:  The reason for this restriction is that prior experiences with
          languages such as LISP and Tcl suggest that this is a workable
          way of noting that a given script uses an extension.

          Experience with languages such as PostScript that have
          extension mechanisms that allow a script to include
          information on how to work around a lack of an extension
          suggest that such mechanisms do not work well in practice.

Showalter                 Expire in Six Months                 [Page 19]

Internet DRAFT                   Sieve                 February 16, 1999

3.      Control Commands

   In order for a script to do more than one set of actions, control
   structures are needed.  In Sieve, a control structure is a command
   that takes a block as an argument.

   In this document, only the "if" control structure is provided.  There
   are three pieces to if: "if", "elsif", and "else".

   Syntax:   if <test1: test> <block1: block>

   Syntax:   elsif <test2: test> <block2: block>

   Syntax:   else <block>

   The semantics are similar to any other programming language this
   appears in.  When the interpreter sees an "if", it evaluates the test
   associated with it.  If the test is true, it executes the block
   associated with it.

   If the test of the "if" is false, it evaluates the test of the first
   "elsif" (if any).  If the test of "elsif" is true, it runs the
   elsif's block.  An elsif may be followed by an elsif, in which case,
   the interpreter repeats this process until it runs out of elsifs.

   When the interpreter runs out of elsifs, there may be an "else" case.
   If there is, and none of the if or elsif tests were true, the
   interpreter runs the else case.

   This provides a way of performing exactly one of the blocks in the
   chain.

   In the following example, both Message A and B are dropped.

   Example:  if header :contains "from" "coyote" {
                discard;
             } elsif header :contains ["subject"] ["$$$"] {
                discard;
             } else {
                fileinto "INBOX";
             }

Showalter                 Expire in Six Months                 [Page 20]

Internet DRAFT                   Sieve                 February 16, 1999

   In the script below, when run over message A, redirects  the  message
   to  [email-masked];  message  B,  to [email-masked]; any
   other message is redirected to [email-masked].

   Example:  if header :contains ["From"] ["coyote"] {
                redirect "[email-masked]";
             } elsif header "Subject" :contains "$$$" {
                redirect "[email-masked]";
             } else {
                redirect "[email-masked]";
             }

4.      Action Commands

   This document supplies six actions that may be taken on a message:
   keep, fileinto, redirect, reject, discard, and stop.

4.1.     Action reject

   Syntax:   reject <reason: string>

   The optional "reject" action resends the message to the sender,
   wrapping it in a "reject" form, noting that it was rejected by the
   recipient.  In the following script, message A is rejected and
   returned to the sender.

   Example:  if header :contains "from" "[email-masked]" {
                reject "I am not taking mail from you, and I don't want
                your birdseed, either!";
             }

   A reject message MUST takes the form of a failed DSN as specified  by
   [DSN].    The  human-readable  portion  of  the  message,  the  first
   component of the DSN, contains the human readable message  describing
   the  error,  although  it SHOULD contain additional text alerting the
   original sender that mail was refused by a filter.  This part of  the
   DSN might appear as follows:

   ------------------------------------------------------------
   Message was refused by recipient's mail filtering program.
   Reason given was as follows:

   I am not taking mail from you, and I don't want your
   birdseed, either!
   ------------------------------------------------------------

   The action-value field as defined in the DSN specification MUST be

Showalter                 Expire in Six Months                 [Page 21]

Internet DRAFT                   Sieve                 February 16, 1999

   "failed".

   A rejected message may not be filed, redirected, or kept.  A message
   that triggers a "reject" action is never allowed to be kept by the
   user, and the "reject" overrides all other actions.

   A message may only be rejected once.

   Because some implementations cannot implement the reject command, it
   is optional.  The capability string to be used with the require
   command is "reject".

4.2.     Action fileinto

   Syntax:   fileinto <folder: string>

   The "fileinto" action drops the message into a named folder.
   Implementations SHOULD support fileinto, but in some environments
   this may be impossible.

   The capability string for use with the require command is "fileinto".

   In  the  following  script,  message   A   is   filed   into   folder
   "INBOX.harassment".

   Example:  if header :contains ["from"] "coyote" {
                fileinto "INBOX.harassment";
             }

4.3.     Action redirect

   Syntax:   redirect <address: string>

   The "redirect" action is used to send the message to another user at
   a supplied address, as a mail forwarding feature does.  The
   "redirect" action makes no changes to the message body or headers,
   and only modifies the envelope recipient.

   A simple script can be used for redirecting:

   Example:  redirect "[email-masked]";

Showalter                 Expire in Six Months                 [Page 22]

Internet DRAFT                   Sieve                 February 16, 1999

   The redirect command performs an MTA-style "forward"--that  is,  what
   you  get from a .forward file using sendmail under UNIX.  The address
   on the SMTP envelope is replaced with the one on the redirect command
   and the message is sent back out.  (This is not an MUA-style forward,
   which creates a new message with a different sender and  message  ID,
   wrapping  the  old  message in a new one.)  The redirect command does
   not add Resent- headers.

4.4.     Action keep

   Syntax:   keep

   The "keep" action is whatever action is taken in lieu of all other
   actions, if no filtering happens at all; generally, this simply means
   to file the message into the user's main mailbox.  This command
   provides a way to execute this action without needing to know the
   name of the user's main mailbox, providing a way to call it without
   needing to understand the user's setup, or the underlying mail
   system.

   Example:  if size :under 1M { keep; } else { discard; }

4.5.     Action stop

   Syntax:   stop

   The "stop" action ends all processing.  If no actions have been
   executed, then the keep action is taken.

4.6.     Action discard

   Syntax:   discard

   Discard drops the message.  In the following script, any mail from
   "[email-masked]" is thrown out.

   Example:  if header :contains ["from"] ["[email-masked]"] {
             discard; }

   Discard takes no arguments.

   While an important part of this language, "discard" has the potential
   to create serious problems for users: A student leaving themselves
   logged in to a machine in a computer lab may find their script
   changed to just "discard".  In order to protect users in this

Showalter                 Expire in Six Months                 [Page 23]

Internet DRAFT                   Sieve                 February 16, 1999

   situation (along with similar situations), implementations MAY keep
   messages destroyed by a script for an indefinite period, and MAY
   disallow scripts that throw out all mail.

4.7.     Action require

   Syntax:   require <capabilities: string-list>

   The require action notes that a script makes use of an certain
   extension.  Such a declaration is required to use the extension, as
   discussed in section 2.10.5.  Multiple capabilities can be declared
   with a single require.

   Example:  require ["fileinto", "reject"];

5.      Test Commands

   Tests are used in conditionals to decide which part(s) of the
   conditional to execute.

5.1.     Test address

   Syntax:   address [ADDRESS-PART] [COMPARATOR] [MATCH-KEYWORD]
             <header-list: string-list> <key-list: string-list>

   The address test matches Internet addresses out of structured headers
   that contain addresses.  It returns true if any header contains any
   key in the specified part of the address, as modified by the
   comparator and the match keyword.

   Like envelope and header, this test returns true if any combination
   of the header-list and key-list arguments match.

   Internet email-addresses have the somewhat awkward characteristic
   that the mailbox-part [IMAIL] to the left of the at-sign is
   considered case sensitive, and the domain-part to the right of the
   at-sign is case insensitive.  The "address" command does not deal
   with this itself, but provides the ADDRESS-PART argument for allowing
   users to deal with it.

   The address primitive never acts on the phrase part of an email
   address, nor on comments within that address.  It also never acts on
   group names, although it does act on the addresses within the group

Showalter                 Expire in Six Months                 [Page 24]

Internet DRAFT                   Sieve                 February 16, 1999

   construct.

   Implementations MUST restrict the address test to headers that
   contain addresses, but MUST include at least From, To, Cc, Bcc,
   Sender, Resent-From, Resent-To, and SHOULD include any other header
   that utilizes an "address-list" structured header body.

   Example:  if address :is :all "from" "[email-masked]" {
                discard;

5.2.     Test allof

   Syntax:   allof ( <test1: test>, <test2: test>, ..., <testN: test> )

   The allof test preforms a logical AND on the tests supplied to it.

   Example:  allof (false, false)  =>   false
             allof (false, true)   =>   false
             allof (true,  true)   =>   true

   The allof test takes as its argument a test-list.

5.3.     Test anyof

   Syntax:   anyof ( <test1: test> , <test2: test> , ..., <testN:  test>
             )

   The anyof test preforms a logical OR on the tests supplied to it.

   Example:  anyof (false, false)  =>   false
             anyof (false, true)   =>   true
             anyof (true,  true)   =>   true

5.4.     Test envelope

   Syntax:   envelope [ADDRESS-PART] [MATCH-KIND]
             <envelope-part: string-list> <key-list: string-list>

   The "envelope" test is true if the specified part of the SMTP (or
   equivalent) envelope matches the specified key.

   If one of the envelope-part strings is (case insensitive) "from",
   then matching occurs against the FROM address used in the SMTP MAIL

Showalter                 Expire in Six Months                 [Page 25]

Internet DRAFT                   Sieve                 February 16, 1999

   command.

   If one of the envelope-part strings is (case insensitive) "to", then
   matching occurs against the TO address used in the SMTP RCPT command
   that resulted in this message getting delivered to this user.  Note
   that only the most recent TO is avaliable.

   The envelope-part is a string list and may contain both "from" and
   "to", in which case the strings specified in the key-list are matched
   against both parts of the envelope.

   Like address and header, this test returns true if any combination of
   the envelope-part and key-list arguments is true.

   All tests against envelopes MUST drop source routes.

   If a protocol other than SMTP is used for message transport,
   implementations are expected to adapt this command, mapping the
   "from" and "to" envelope parts to the appropriate parts of the
   envelope.

   Example:  if envelope :all :is "from" "[email-masked]" {
                discard;
             }

5.5.     Test exists

   Syntax:   exists <header-names: string-list>

   The "exists" test is true if the headers listed in the header-names
   argument exist within the message.  All of the headers must exist or
   the test is false.

   The following example throws out mail that doesn't have a From header
   and a Date header.

   Example:  if not :exists ["From","Date"] {
                discard;
             }

5.6.     Test false

   Syntax:   false

   The "false" test always evaluates to false.

Showalter                 Expire in Six Months                 [Page 26]

Internet DRAFT                   Sieve                 February 16, 1999

5.7.     Test header

   Syntax:   header [COMPARATOR] [MATCH-TYPE]
             <header-names: string-list> <key-list: string-list>

   The "header" test evaluates to true if the any header name matches
   any key.  The type of match is specified by the optional match
   argument, which defaults to ":is" if not specified, as specified in
   section 2.6.

   Like address and envelope, this test returns true if any combination
   of the string-list and key-list arguments match.

   If a header listed in the header-names argument exists,  it  contains
   the  null  key ("").  However, if the named header is not present, it
   does not contain the null key. So if a message contained the header

           X-Caffeine: C8H10N4O2

   these tests on that header evaluate as follows:

           header :is ["X-Caffeine"] [""]         => false
           header :contains ["X-Caffeine"] [""]   => true

5.8.     Test not

   Syntax:   not <test>

   The "not" test takes some other test as an argument, and yields the
   opposite result.

5.9.     Test size

   Syntax:   size <":over" / ":under"> <limit: number>

   The "size" test deals with the size of a message.  It takes either a
   tagged argument of ":over" or ":under", followed by a number
   representing the size of the message.

   If the argument is ":over", and the size of the message is greater
   than the number provided, the test is true; otherwise, it is false.

   If the argument is ":under", and the size of the message is less than
   the number provided, the test is true; otherwise, it is false.

Showalter                 Expire in Six Months                 [Page 27]

Internet DRAFT                   Sieve                 February 16, 1999

   One of ":over" or ":under" must be specified.

   The size of a message is defined to be the number of octets from the
   initial header until the last character in the message body.

6.      Extensibility

   New control structures, actions, and tests can be added to the
   language.  Sites must make these features known to their users; this
   document does not define a way to discover the list of extensions
   supported by the server.

   Any extensions to this language MUST define a capability string that
   uniquely identifies that extension.  If a new version of an extension
   changes the functionality of a previously defined extension, it MUST
   use a different name.

   In a situation where there is a submission protocol and an extension
   advertisement mechanism aware of the details of this language,
   scripts submitted can be checked against the mail server to prevent
   use of an extension that that the server does not support.

   Extensions should state how they interact with constrants defined in
   section 2.10 (for instance, whether they cancel the implicit keep, or
   if they change delivery status).

6.1.     Capability String

   Capability strings are typically short strings describing what
   capabilities are supported by the server.

   Capability strings beginning with "vnd." represent vendor-defined
   extensions.  Such extensions are not defined by Internet standards or
   RFCs, but are still registered with IANA in order to prevent
   conflicts.  Extensions starting with "vnd." should be followed by the
   name of the vendor, such as "vnd.acme.rocket-sled".

   The following capability strings are defined by this document:

   envelope    The string "envelope" indicates that the implementation
               supports the "envelope" command.

   fileinto    The string "fileinto" indicates that the implementation
               supports the "fileinto" command.

   reject      The string "reject" incidates that the implementation
               supports the "reject" command.

Showalter                 Expire in Six Months                 [Page 28]

Internet DRAFT                   Sieve                 February 16, 1999

   comparator- The string "comparator-elbonia" is provided if the
               implementation supports the "elbonia" comparator.
               Therefore, all implementations have at least the
               "comparator-i;octet" capability.

6.2.     Registry

   In order to provide a standard set of extensions, a registry is
   provided by IANA.  Capability names may be registered on a first-
   come, first-served basis.  Extensions designed for interoperable use
   should be defined as standards track or IESG approved experimental
   RFCs.

   To: [email-masked]
   Subject: Registration of new Sieve extension

   Capability name:
   Capability keyword:
   Capability arguments:
   Standards Track/IESG-approved experimental RFC number:
   Person and email address to contact for further information:

6.3.     Capability Transport

   As the range of mail systems that this draft is intended to apply to
   is quite large, a method of advertising which capabilities an
   implementation supports is difficult due to the wide range of
   possible implementations.  Such a mechanism, however, should have the
   following properties.

   (1)  The implementation can advertise the complete set of extensions
        that it supports.

   OPEN:   There needs to be a more complete description here,
           suggestions appreciated.

7.      Transmission

   The MIME type for a Sieve script is "application/sieve".

   The registration of this type for RFC 2048 requirements is as
   follows:

        Subject: Registration of MIME media type applicaton/sieve

        MIME media type name: application

Showalter                 Expire in Six Months                 [Page 29]

Internet DRAFT                   Sieve                 February 16, 1999

        MIME subtype name: sieve
        Required parameters: none
        Optional parameters: none
        Encoding considerations: Most sieve scripts will be textual,
           written in UTF-8.  When non-7bit characters are used,
           quoted-printable would be appropriate for transport systems
           that require 7bit encoding.
        Security considerations: Discussed in section 10 of RFC XXXX.
        Interoperability considerations: Discussed in section 2.10.5
           of RFC XXXX.
        Published specification: RFC XXXX.
        Applications which use this media type: sieve-enabled mail servers
        Additional information:
          Magic number(s):
          File extension(s): .siv
          Macintosh File Type Code(s):
        Person & email address to contact for further information:
           See the discussion list at [email-masked].
        Intended usage:
           COMMON
        Author/Change controller:
           See Author information in RFC XXXX.

9.      Parsing

9.1.     Lexical Tokens

   Sieve scripts are encoded in UTF-8.  The following assumes a valid
   UTF-8 encoding; special characters in Sieve scripts are all ASCII.

   The following are tokens in Sieve:
           - identifiers
           - tags
           - numbers
           - quoted strings
           - multi-line strings
           - other separators

   Blanks, horizonal tabs, newlines, formfeeds, and comments ("white
   space") are ignored except as they separate tokens.  Some white space
   is required to separate otherwise adjacent tokens and in specific
   places in the multi-line strings.

   The other separators are single individual characters, and are
   mentioned explicitly in the grammar.

   The lexical structure of sieve is defined in the following BNF (as

Showalter                 Expire in Six Months                 [Page 30]

Internet DRAFT                   Sieve                 February 16, 1999

   described in [ABNF]):

   CHAR-NOT-DOT = (%x01-2d / %x2f-%xff)

   CHAR-NOT-CRLF = (%x01-09 / %x0b-%x0c / %x0e-%xff)

   comment = "#" *CHAR-NOT-CRLF CRLF

   identifier = (ALPHA / "_") *(ALPHA DIGIT "_")

   tag = ":" identifier

   number = 1*DIGIT [QUANTIFIER]

   QUANTIFIER = "K" / "M" / "G"

   quoted-string = DQUOTE *CHAR DQUOTE         ;; in general,  CHAR
   inside a string maps to CHAR         ;; so         ;; note that
   newlines and other characters are all allowed strings

   multi-line = "text:" *(SP / HTAB) (comment / CRLF)
           *((1*CHAR-NOT-DOT *CHAR CRLF) / ("." 1*CHAR-NOT-DOT *CHAR
   CRLF) /           (".." *CHAR CRLF) / CRLF)         "." CRLF
           ;; note when used,         ;; a leading ".." on a line is
   mapped to ".".

   white-space = 1*(SP / CRLF / HTAB) / comment

9.2.     Grammar

   The following is the grammar of Sieve after it has been lexical
   interpreted.  No white space or comments appear below.  The start
   symbol is "start".

   argument = string-list / number / tag

   arguments = *argument [test / test-list]

   block = "{" commands "}"

   command = identifier arguments ( ";" / block )

   commands = *command

   start = commands

   string = quoted-string / multi-line

Showalter                 Expire in Six Months                 [Page 31]

Internet DRAFT                   Sieve                 February 16, 1999

   string-list = "[" string *("," string) "]" / string         ;; if
   there is only a single string, the brackets are optional

   test = identifier arguments

   test-list = "(" test *("," test) ")"

9.      Security Considerations

   Users must get their mail.  It is imperative that whatever method
   implementations use to store the user-defined filtering scripts be
   secure.

   It is equally important that implementations sanity-check the user's
   scripts, and not allow users to create on-demand mailbombs.  For
   instance, an implementation that allows a user to reject or redirect
   multiple times to a single message might also allow a user to create
   a mailbomb triggered by mail from a specific user.

   Therefore, an implementation SHOULD only allow one "reject" per
   message processed, and MAY limit the number of redirect actions
   taken.  An implementation MUST refuse to redirect a message to
   itself.  [OPEN: What do you do when a site limit prevents you from
   this?  Say I do three replies; which ones take effect when the limit
   is 1? 2? 0?]

   Several commands, such as "discard", "redirect", and "fileinto" allow
   for actions to be taken that are potentially very dangerous.

   In order to prevent mail loops, implementations must prevent messages
   from passing through a given user twice.

10.     Acknowledgments

   I am very thankful to Chris Newman for his support and his ABNF
   syntax checker, to John Myers and Steve Hole for outlining the
   requirements for the original drafts, to Larry Greenfield for nagging
   me about the grammar and finally fixing it, to Greg Sereda for
   repeatedly fixing examples and finding errors, and to Rob Earhart for
   an early implementation and a great deal of help.  I am also indebted
   to all of the readers of the [email-masked] mailing list.

Showalter                 Expire in Six Months                 [Page 32]

Internet DRAFT                   Sieve                 February 16, 1999

11.     Author's Address

   Tim Showalter
   Carnegie Mellon University
   5000 Forbes Avenue
   Pittsburgh, PA 15213

   E-Mail: [email-masked]

Appendix A.  References

   [ABNF] Crocker,  D.,  and  P.  Overell,  "Augmented  BNF  for  Syntax
   Specifications:   ABNF", Internet Mail Consortium, RFC 2234, November
   1997.

   [DSN] Moore, K., and G. Vaudreuil, "An Extensible Message Format  for
   Delivery Status Notifications", RFC 1894, January 1996.

   [FLAMES] Borenstein, N, and C. Thyberg,  "Power,  Ease  of  Use,  and
   Cooperative  Work  in a Practical Multimedia Message System", Int. J.
   of Man-Machine Studies, April, 1991.  Reprinted in Computer-Supported
   Cooperative  Work  and  Groupware,  Saul  Greenberg, editor, Harcourt
   Brace Jovanovich, 1991.   Reprinted  in  Readings  in  Groupware  and
   Computer-Supported  Cooperative  Work, Ronald Baecker, editor, Morgan
   Kaufmann, 1993.

   [KEYWORDS] Bradner, S., "Key  words  for  use  in  RFCs  to  Indicate
   Requirement Levels", RFC 2119, Harvard University, March 1997.

   [IMAP] Crispin, M.,  "Internet  Message  Access  Protocol  -  version
   4rev1", RFC 2060, University of Washington, December 1996.

   [IMAIL] Crocker, D., "Standard for the Format of ARPA  Internet  Text
   Messages", STD 11, RFC 822, University of Delaware, August 1982.

   [MIME] Freed, N., and  N.  Borenstein,  "Multipurpose  Internet  Mail
   Extensions  (MIME)  Part One: Format of Internet Message Bodies", RFC
   2045, Innosoft and First Virtual, November 1996.

   [SMTP] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC  821,
   USC/Information Sciences Institute, August 1982.

   [UTF-8] Yergeau, F. "UTF-8, a transformation format  of  Unicode  and
   ISO 10646", RFC 2044, Alis Technologies, October 1996.

Showalter                 Expire in Six Months                 [Page 33]

Internet DRAFT                   Sieve                 February 16, 1999

Appendix B.  Full Copyright Statement

   Copyright (C) The Internet Society 1999. All Rights Reserved.

   This document and translations of it may be copied and  furnished  to
   others,  and derivative works that comment on or otherwise explain it
   or assist in its implementation may be  prepared,  copied,  published
   and  distributed,  in  whole  or  in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included  on  all  such  copies  and derivative works.  However, this
   document itself may not be modified in any way, such as  by  removing
   the  copyright  notice or references to the Internet Society or other
   Internet  organizations,  except  as  needed  for  the   purpose   of
   developing  Internet  standards  in  which  case  the  procedures for
   copyrights  defined  in  the  Internet  Standards  process  must   be
   followed,  or  as  required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will  not  be
   revoked by the Internet Society or its successors or assigns.

   This document and the information contained herein is provided on  an
   "AS  IS"  basis and THE INTERNET SOCIETY AND THE INTERNET ENGINEERING
   TASK FORCE DISCLAIMS ALL WARRANTIES, EXPRESS  OR  IMPLIED,  INCLUDING
   BUT  NOT  LIMITED  TO  ANY  WARRANTY  THAT THE USE OF THE INFORMATION
   HEREIN WILL NOT INFRINGE ANY RIGHTS  OR  ANY  IMPLIED  WARRANTIES  OF
   MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.

Showalter                 Expire in Six Months                 [Page 34]


--Multipart_Tue_Feb_16_18:07:36_1999-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="sieve-vacation.txt"
Content-Transfer-Encoding: 7bit

Network Working Group                                       T. Showalter
Internet Draft: Sieve: Vacation Extension                Carnegie Mellon
Document: draft-showalter-sieve-vacation-00bis.txt     February 16, 1999
Expire in six months

                       Sieve: Vacation Extension

Status of this memo

   This document is an Internet-Draft.  Internet-Drafts are working
   documents of the Internet Engineering Task Force (IETF), its areas,
   and its working groups.  Note that other groups may also distribute
   working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as ``work in progress.''

   To learn the current status of any Internet-Draft, please check the
   ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
   Directories on ftp.is.co.za (Africa), ftp.nordu.net (Europe),
   munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
   ftp.isi.edu (US West Coast).

   The protocol discussed in this document is experimental and subject
   to change.  Persons planning on either implementing or using this
   protocol are STRONGLY URGED to get in touch with the author before
   embarking on such a project.

Abstract

   This document describes an extension to the Sieve mail filtering
   language for an autoresponder similar to that of the Unix "vacation"
   command for replying to messages with certain safety features to
   prevent problems.

Copyright

   Copyright (C) The Internet Society 1999.  All Rights Reserved.

Showalter                 Expire in Six Months                  [Page 1]

Internet DRAFT         Sieve: Vacation Extension       February 16, 1999

0. Meta-information on this draft

   This information is intended to facilitate discussion.  It will be
   removed when this document leaves the Internet-Draft stage.

0.1. Discussion

   This draft is intended to be an extension to the Sieve mail filtering
   language, avaliable from the Internet-Drafts repository as
   <ftp://ftp.ietf.org/internet-drafts/draft-showalter-sieve-06.txt>
   (where 06 is the version number, which is actually currently 06).

   This draft and the Sieve language itself are being discussed on the
   MTA Filters mailing list at <[email-masked]>.  Subscription
   requests can be sent to <[email-masked]> (send an
   email message with the word "subscribe" in the body).  More
   information on the mailing list along with a WWW archive of back
   messages is available at <http://www.imc.org/ietf-mta-filters/>.

1. Introduction

   This is an extension to the Sieve language defined by [SIEVE] for
   notification that messages will not be immediately answered.

   Conventions for notations are as in [SIEVE] section 1.1, including
   use of [KEYWORDS].

2. Capability Identifier

   Sieve implementations that implement vacation have an identifier of
   "vacation" for use with the capability mechanism.

3. Vacation Action

   Syntax:   vacation [":days" number] [":addresses" string-list]
             <reason: string>

   The "vacation" action implements a vacation autoresponder similar to
   the vacation command  available under many versions of Unix.  Its
   purpose is to provide correspondents with notification that the user
   is away for an extended period of time and that they should not
   expect quick responses.

   "Vacation" is used to respond to a message with another message.
   Vacation's messages are always addressed to the Return-Path address
   (that is, the envelope from address) of the message being responded
   to.

Showalter                 Expire in Six Months                  [Page 3]

Internet DRAFT         Sieve: Vacation Extension       February 16, 1999

   The ":days" argument is used to specify the period in which addresses
   are kept and are not responded to, and is always specified in days.
   The minimum value used for this parameter is 1.  Sites MAY define a
   different minimum value.

   If ":days" is omitted, the default value is 7, or the minimum value
   (as defined above), whichever is greater.

   If the parameter given to ":days" is greater than the minimum value,
   then the minimum value is used instead.

   "Vacation" keeps track of all of the addresses that it has responded
   to in some period (as specified by the :days optional argument).  If
   vacation has not previously responded to this address within that
   time period, it sends the "reason" argument to the Return-Path
   address of the message that is being responded to.

   "Vacation" never responds to a message unless the user's email
   address is in the "To" or "Cc" line of the original message.
   Implementations are assumed to be able to know this information, but
   users may have additional addresses beyond the control of the local
   mail system.

   Users can supply additional mail addresses that are theirs with the
   ":addresses" argument, which takes a string-list listing additional
   addresses that a user might have.

   Example:
             vacation :days 23 :addresses ["[email-masked]", "[email-masked]"]
                "I'm away until October 19.  If it's an emergency, call
                911, I guess." ;

   By mingling vacation with other rules, users can do something more
   selective.

   Example:
             if header :contains "from" "[email-masked]" {
                forward "[email-masked]";
             } elsif header :contains ["to", "cc"]
                   "[email-masked]" {
                vacation "Sorry, I'm away, I'll read your message
                   when I get around to it.";
             }

Showalter                 Expire in Six Months                  [Page 4]

Internet DRAFT         Sieve: Vacation Extension       February 16, 1999

4. Interaction with Other Sieve Actions

   Vacation does not affect the implicit keep.

   Vacation may not be used with reject.

5. Security Considerations

   It is critical that implementations correctly implement the
   limitations described above: Replies MUST NOT be sent out in response
   to messages not sent directly to the user, and replies MUST NOT be
   sent out more often than the :days argument states.

6. Author's Address

   Tim Showalter
   Carnegie Mellon University
   5000 Forbes Avenue
   Pittsburgh, PA 15213

   E-Mail: [email-masked]

Showalter                 Expire in Six Months                  [Page 5]

Internet DRAFT         Sieve: Vacation Extension       February 16, 1999

Appendix A.  References

   [KEYWORDS] Bradner, S., "Key  words  for  use  in  RFCs  to  Indicate
   Requirement Levels", RFC 2119, Harvard University, March 1997.

   [SIEVE] Showalter, T.,  "Sieve: A Mail Filtering Language",  Carnegie
   Mellon, Work in Progress.

Appendix B. Full Copyright Statement

   Copyright (C) The Internet Society 1999. All Rights Reserved.

   This document and translations of it may be copied and  furnished  to
   others,  and derivative works that comment on or otherwise explain it
   or assist in its implementation may be  prepared,  copied,  published
   and  distributed,  in  whole  or  in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included  on  all  such  copies  and derivative works.  However, this
   document itself may not be modified in any way, such as  by  removing
   the  copyright  notice or references to the Internet Society or other
   Internet  organizations,  except  as  needed  for  the   purpose   of
   developing  Internet  standards  in  which  case  the  procedures for
   copyrights  defined  in  the  Internet  Standards  process  must   be
   followed,  or  as  required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will  not  be
   revoked by the Internet Society or its successors or assigns.

This document will expire before 31 July 1999.

Showalter                 Expire in Six Months                  [Page 6]


--Multipart_Tue_Feb_16_18:07:36_1999-1--

Date: 16 Feb 1999 18:07:27 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: reject imples stop?
Sender: [email-masked]

Should a reject imply a stop?  If reject is incompatible with all other
actions, this is a very reasonable behavior.

If first-action-encountered wins, what happens when you fileinto, then
reject?

Tim

Date: 16 Feb 1999 17:36:39 -0500
From: Tim Showalter <[email-masked]>
To: Gregory Sereda <[email-masked]>
Cc: [email-masked]
Subject: Re: sieve-06bis
Sender: [email-masked]

> Date: Tue, 16 Feb 1999 17:13:09 -0500
> From: Gregory Sereda <[email-masked]>

> The spec should make a statement concerning the "case" of the
> sieve language.  Since there is no statement, I assume that
> sieve language is case-sensitive and must be lower case as
> shown in the examples.

Good point.  I intended case insensitivity but am indifferent.  I'd
better make that clear.  I'll add this to 2.1:

| Tokens in the ASCII range are considered case-insensitive.

If I edit section 2 again and do any significant rewrite I'll add more
discussion of tokens.

>    Syntax:   [ < ":is" / ":contains" / ":matches" > <key: string> ]
>                                                     ^^^^^^^^^^^^^
> This is incorrect, or at least misleading. 

It is incorrect, and I've removed the key bit.  I don't think that this
is what we want.

> In general, moving the tagged arguments before the positional arguments
> results in some confusion because the tagged arguments and the positional
> arguments which they affect may be interspersed with other arguments.
> This, I think, makes sieve less intuitive.  Nevertheless, my major need
> is that we clearly specify the current sieve and resist the temptation
> to tweak the language syntax, except for very good reasons.

I agree with you, and I think several other people do as well (this
opinion was stated in Orlando: we don't like it, but we don't feel like
changing it).  I have no problem with allowing tagged arguments anywhere 
on the command line.

>    The kind of comparison is done, such as whether or not the comparison
>    done is case-insensitive, is specified as a comparator argument to
>    the test. 
> >> add referrence to ADDRESS-PART, for example....
> >> For convienence, the ADDRESS-PART syntax element  is  defined  here  as
> >> follows:

Oh, @#^&*.  Fixed.

Thanks for the rest of the corrections, they've all been made in the source.

Date: 16 Feb 1999 17:26:53 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve-06bis 
Sender: [email-masked]

> Date: Tue, 16 Feb 1999 11:01:03 +0100

> | Implementations decode header charsets to UTF-8.  Two strings are
> | considered equal if their UTF-8 representations are identical.
> | Implementations should decode charsets represented in the forms
> | specified by [MIME] for both message headers and bodies.
> | Implementations must be capable of decoding US-ASCII, ISO-8859-1,
> | the ASCII subset of ISO-8859-* character sets, and UTF-8.
> 
> I think that ISO-8859-15 would be more appropriate than -1, it fixes 
> the bugs in -1 and adds the euro.

For better or worse, I believe 8859-1 is more common and should be
required, but I don't have a string opinion on the subject.

Is this not the case?

> | If implementations fail to support the above behavior, they MUST
> | conform to the following:
> | 
> | No two strings containing 8-bit data can be considered equal.
> 
> I agree with what I think that you mean but shouldn't it say something 
> more like:
> 
> No two strings can be considered equal if either string contains octets 
> greater than 127.

You're right; changed.

> [...]
> | 2.10.3.  Message Uniqueness in a Mailbox
> | 
> | Implementations SHOULD NOT write a message to a mailbox where a copy
> | of it already exists, even if a script explicitally asks for a
> | message to be written to a mailbox twice.
> | 
> | The test for equality of two messages is not defined by this memo.
> 
> I think that this is a little tough although of course it isn't 
> mandatory. Perhaps it should be mandatory for a script to not deliver 
> more than once to a mailbox .

I'm not sure what you want.  That language is weasily enough to allow an 
awful lot, quite possibly too much.

The reason for that second paragraph is that I consider two messages
with the same message-id equal enough, but others will want to compare
bodies in some meaningful way.

> What should happen if a require is not satisfied? I would guess that a 
> required extension would be checked when the script was loaded but what 
> happens if an extension is removed?

The script doesn't run at all.  I've added this sentence to 2.10.5:

| If a script does not understand an extension declared with require,
| the script must not be used at all.

> [Re: 9.1 definition of multi-line]
> This is slightly different to the definition in 2.4.2 in that it allows 
> white space after the :.

2.4.2 fixed.

> [...]
> | In order to prevent mail loops, an implementation MUST refuse to
> | filter a message that it has already filtered once; that is, a
> | message must not pass through a given server twice.
> 
> This seems excessive to me, especially as servers are becoming larger 
> and larger all the time. I think that mail loops would be prevented if 
> a message could only be kept or discarded when it had been seen twice 
> by the same user.

How would one write such a script?

I think that this should be on a per-user basis, not a per-server basis,
and I'll fix it accordingly:

| In order to prevent mail loops, implementations must prevent messages
| from passing through a given user twice.

I think this is what I intended, and I believe it's a clear improvement.

I only want to discuss the case where a user relays a message to himself 
(i.e., a loop).  Two messages with the same message-id can have
different return-path values (say, if one hits a mailing list) and I
don't want to require anything in that case; that's normal and fine and
scripts should handle it accordingly.

Date: Tue, 16 Feb 1999 17:13:09 -0500
To: Tim Showalter <[email-masked]>, [email-masked]
From: Gregory Sereda <[email-masked]>
Subject: Re: sieve-06bis
Sender: [email-masked]

At 03:11 PM 2/11/99 -0500, Tim Showalter wrote:
>Hi.  This draft has some of the changes folks have asked for.

I have a few comments.

The spec should make a statement concerning the "case" of the
sieve language.  Since there is no statement, I assume that
sieve language is case-sensitive and must be lower case as
shown in the examples.

In draft 6bis...

 The test-list syntax element provides a way of grouping tests.

   Example:  if any-of (not exists ["From", "Date"],
                ^^^^^^ typo, should be anyof
                   header :contains "from" "[email-masked]") {

...
   For convienence, the MATCH-TYPE syntax element  is  defined  here  as
   follows:

   Syntax:   [ < ":is" / ":contains" / ":matches" > <key: string> ]
                                                    ^^^^^^^^^^^^^
This is incorrect, or at least misleading.  This tagged argument does
not take an argument.  This tagged argument does affect the key-list
argument which is positional and 2nd position on all commands.  In
other words, the ":matches" tag does not allow for wild card matchs
on the header-names, only the key-list argument.  This is similar to
the ":compartor" tag, except that it takes an argument.

In general, moving the tagged arguments before the positional arguments
results in some confusion because the tagged arguments and the positional
arguments which they affect may be interspersed with other arguments.
This, I think, makes sieve less intuitive.  Nevertheless, my major need
is that we clearly specify the current sieve and resist the temptation
to tweak the language syntax, except for very good reasons.

...
   The kind of comparison is done, such as whether or not the comparison
   done is case-insensitive, is specified as a comparator argument to
   the test. 
>> add referrence to ADDRESS-PART, for example....
>> For convienence, the ADDRESS-PART syntax element  is  defined  here  as
>> follows:

   Syntax:   < ":localpart" / ":domain" / ":all" > ":localpart"
                                                   ^^^^^^^^^^^^ typo?? remove
...
 Example:  if header :contains "from" "coyote" {
                discard;
             } elsif :contains header ["subject"] ["$$$"] {
                     ^^^^^^^^^^^^^^^^ syntax, header :contains
                discard;
...
Example:  if header :contains ["From"] ["coyote"] {
                redirect "[email-masked]";
             } elsif header "Subject" contains "$$$" {
                            ^^^^^^^^^^^^^^^^^^ syntax, :contains "Subject"
                redirect "[email-masked]";

Greg Sereda

To: [email-masked]
Subject: Re: sieve-06bis 
Date: Tue, 16 Feb 1999 11:01:03 +0100
From: Michael Salmon <[email-masked]>
Sender: [email-masked]

+----- On 11 Feb 1999 15:11:44 EST, Tim Showalter writes:
| --Multipart_Thu_Feb_11_15:11:43_1999-1
| Content-Type: text/plain; charset=US-ASCII
| 
| Hi.  This draft has some of the changes folks have asked for.  Notably
| missing are the things Steve posted that I wasn't sure about, noted in
| my previous message, and anything related to multiple fileinto.

Hi
   a couple of minor points.

/Michael

[...]
| 2.7.2.   Comparisons across Character Sets
| 
| All Sieve scripts are represented in UTF-8, but messages may involve
| a number of character sets.  In order for comparisons to work across
| character sets, implementations SHOULD implement the following
| behavior:
| 
| Implementations decode header charsets to UTF-8.  Two strings are
| considered equal if their UTF-8 representations are identical.
| Implementations should decode charsets represented in the forms
| specified by [MIME] for both message headers and bodies.
| Implementations must be capable of decoding US-ASCII, ISO-8859-1,
| the ASCII subset of ISO-8859-* character sets, and UTF-8.

I think that ISO-8859-15 would be more appropriate than -1, it fixes 
the bugs in -1 and adds the euro.

| If implementations fail to support the above behavior, they MUST
| conform to the following:
| 
| No two strings containing 8-bit data can be considered equal.

I agree with what I think that you mean but shouldn't it say something 
more like:

No two strings can be considered equal if either string contains octets 
greater than 127.

[...]
| 2.10.3.  Message Uniqueness in a Mailbox
| 
| Implementations SHOULD NOT write a message to a mailbox where a copy
| of it already exists, even if a script explicitally asks for a
                                         ^^^^^^^^^^^^ explicitly
| message to be written to a mailbox twice.
| 
| The test for equality of two messages is not defined by this memo.

I think that this is a little tough although of course it isn't 
mandatory. Perhaps it should be mandatory for a script to not deliver 
more than once to a mailbox .

[...]
[...]
| 4.7.     Action require
| 
| 
| Syntax:   require <capabilities: string-list>
| 
| The require action notes that a script makes use of an certain
| extension.  Such a declaration is required to use the extension, as
| discussed in section 2.10.2.  Multiple capabilities can be declared
| with a single require.
| 
| 
| Example:  require ["fileinto", "envelope"];

What should happen if a require is not satisfied? I would guess that a 
required extension would be checked when the script was loaded but what 
happens if an extension is removed?

[...]
| 9.1.     Lexical Tokens
| 
| Sieve scripts are encoded in UTF-8.  The following assumes a valid
| UTF-8 encoding; special characters in Sieve scripts are all ASCII.
| 
| The following are tokens in Sieve:
[...]
| multi-line = "text:" *(SP / HTAB) (comment / CRLF)
| *((1*CHAR-NOT-DOT *CHAR CRLF) / ("." 1*CHAR-NOT-DOT *CHAR
| CRLF) /           (".." *CHAR CRLF) / CRLF)         "." CRLF
| ;; note when used,         ;; a leading ".." on a line is
| mapped to ".".

This is slightly different to the definition in 2.4.2 in that it allows 
white space after the :.

[...]
| In order to prevent mail loops, an implementation MUST refuse to
| filter a message that it has already filtered once; that is, a
| message must not pass through a given server twice.

This seems excessive to me, especially as servers are becoming larger 
and larger all the time. I think that mail loops would be prevented if 
a message could only be kept or discarded when it had been seen twice 
by the same user.

Date: 15 Feb 1999 20:22:30 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

There are two things I realized I failed to do with this vacation draft.

When I distributed the previous version, someone wanted it such that
headers could be optionally specified.  I forgot and dropped the ball on 
this one.  Do folks still want that?

When I was talking about this version, I suggested adding the language
for the reply.  I withdraw my suggestion, because that data can be
encoded in the UTF-8 of the body (forgive me, I can't remember the RFC
number that published that Unicode Consortium action), and that's the
right thing anyway.  I ignored the suggestion that the charset be
specified, based on the UTF-8-for-everyone theory, but if we wanted to
suggest a way for the interpreter to massage UTF-8 into something else,
that would be different.

Other things to consider include specifying Subject values for the reply.

Date: Tue, 16 Feb 1999 18:13:48 -0700
From: Alexey Melnikov <[email-masked]>
To: Tim Showalter <[email-masked]>
CC: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

Tim Showalter wrote:

> > Date: Mon, 15 Feb 1999 13:04:55 -0800
> > From: "J.D. Falk" <[email-masked]>
> >
> > On 02/15/99, Tim Showalter <[email-masked]> wrote:
> >
> > >    The ":days" argument is used to specify the period in which addresses
> > >    are kept and are not responded to, and is always specified in days.
> > >    The minimum and default value is 7.
> >
> >       Apologies if this has already been threshed out, but why was
> >       seven days chosen as the minimum?  I'm sure we'll see quite a
> >       few implementations which choose to ignore that.
> >
> >       Perhaps it SHOULD be seven days, and MUST be at least one?
>
> Actually, I have no idea why I chose seven days.
>
> I have no problem making seven the default and making one the minimum,
> although this is probably one of those things that should be
> site-configurable.

7 days rule seems strange for me as well. This value should be
site-configurable.

> How about a paragraph that says if the value is less than the
> site-defined minimum, then the site-defined minimum value is used?

This would be fine for me.

--
Regards,
Alexey Melnikov

Date: 15 Feb 1999 20:03:10 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

> Date: Mon, 15 Feb 1999 13:04:55 -0800
> From: "J.D. Falk" <[email-masked]>
> 
> On 02/15/99, Tim Showalter <[email-masked]> wrote: 
> 
> >    The ":days" argument is used to specify the period in which addresses
> >    are kept and are not responded to, and is always specified in days.
> >    The minimum and default value is 7.
> 
> 	Apologies if this has already been threshed out, but why was
> 	seven days chosen as the minimum?  I'm sure we'll see quite a
> 	few implementations which choose to ignore that.
> 
> 	Perhaps it SHOULD be seven days, and MUST be at least one?

Actually, I have no idea why I chose seven days.

I have no problem making seven the default and making one the minimum,
although this is probably one of those things that should be
site-configurable.

How about a paragraph that says if the value is less than the
site-defined minimum, then the site-defined minimum value is used?

Tim

Date: 15 Feb 1999 16:43:14 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: sieve-06bis
Sender: [email-masked]

> Date: Sat, 13 Feb 1999 14:12:53 -0500
> From: Tony Hansen <[email-masked]>
> 
> Tim Showalter wrote:
> > 
> > Hi.  This draft has some of the changes folks have asked for.  Notably
> > missing are the things Steve posted that I wasn't sure about, noted in
> > my previous message, and anything related to multiple fileinto.
> 
> A few typos and mostly minor comments.

Thank you.

> As I was reading section 4, I kept wondering what the "require" string
> was supposed to be for each of the optional commands. I suggest adding
> that information to each section of an action that is optional.
> 
>    Because some implementations cannot implement the reject command, it
>    is optional.
>                ^^ The string to be used for the require command is "reject".
> 

> What is "envelope" supposed to represent? The envelope test is not
> optional, or if it is, it's not marked as such.

Does this need to be optional?  I can't remember anymore.

> 5.4.     Test envelope
> 
> This section is written strictly in terms of SMTP. Other transfer protocols
> do exist and should not be dismissed.

I'd rather going to add some generic text at the bottom.  Is that okay?

(I've fixed the RFC-822 reference, of course.)

I've added this text to the bottom of 5.4:
| If a protocol other than SMTP is used for message transport,
| implementations are expected to adapt this command, mapping the "from"
| and "to" envelope parts to the appropriate parts of the envelope.

> The Test address and Test envelope sections need examples:
> 
>    Example:     if address :all "from" :is "[email-masked]" {
>                       discard;
>                 }
> 
>    Example:     if envelope :all "from" :is "[email-masked]" {
>                       discard;
>                 }

I've added these, moving the :is argument towards the front of the
command (envelope :all :is "from" "[email-masked]").

> 7.      Transmission

> This needs the complete registration section from the MIME documents
> (RFC 2048). Suggested text follows:

I'm doing some markup, but will otherwise take this completely.

I assume we need a Mac filetype.  I can't remember the rules on those;
can someone come up with one?  (SIVE, in whatever case is appropriate,
would be good, I think).

Thanks...

Date: Mon, 15 Feb 1999 13:04:55 -0800
From: "J.D. Falk" <[email-masked]>
To: [email-masked]
Subject: Re: sieve vacation draft, really
Sender: [email-masked]

On 02/15/99, Tim Showalter <[email-masked]> wrote: 

>    The ":days" argument is used to specify the period in which addresses
>    are kept and are not responded to, and is always specified in days.
>    The minimum and default value is 7.

	Apologies if this has already been threshed out, but why was
	seven days chosen as the minimum?  I'm sure we'll see quite a
	few implementations which choose to ignore that.

	Perhaps it SHOULD be seven days, and MUST be at least one?

-- 
J.D. Falk <[email-masked]>                     Got clue?  http://www.ispf.com/
Special Agent In Charge (Abuse Issues)
Critical Path, Inc.

Date: 15 Feb 1999 15:40:08 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: sieve vacation draft, really
Sender: [email-masked]

--Multipart_Mon_Feb_15_15:40:08_1999-1
Content-Type: text/plain; charset=US-ASCII

Hi.  This message is nearly exactly the same as my previous message with 
the addition of the vacation draft.

This is a second stab at a vacation extension.  Please take a look at it.

Lowlights: I'm not satisfied with section 4.  If someone can suggest
good wording for both the base document and section 4 in this document
that makes action interactions clear, I'd really appreciate it.
Otherwise the interactions are going to be very badly defined and
implemented.

Tim

--Multipart_Mon_Feb_15_15:40:08_1999-1
Content-Type: text/plain; charset=US-ASCII
Content-Disposition: attachment; filename="sieve-vacation.txt"
Content-Transfer-Encoding: 7bit

Network Working Group                                       T. Showalter
Internet Draft: Sieve: Vacation Extension                Carnegie Mellon
Document: draft-showalter-sieve-vacation-00bis.txt     February 15, 1999
Expire in six months

                       Sieve: Vacation Extension

Status of this memo

   This document is an Internet-Draft.  Internet-Drafts are working
   documents of the Internet Engineering Task Force (IETF), its areas,
   and its working groups.  Note that other groups may also distribute
   working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as ``work in progress.''

   To learn the current status of any Internet-Draft, please check the
   ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
   Directories on ftp.is.co.za (Africa), ftp.nordu.net (Europe),
   munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
   ftp.isi.edu (US West Coast).

   The protocol discussed in this document is experimental and subject
   to change.  Persons planning on either implementing or using this
   protocol are STRONGLY URGED to get in touch with the author before
   embarking on such a project.

Abstract

   This document describes an extension to the Sieve mail filtering
   language for an autoresponder similar to that of the Unix "vacation"
   command for replying to messages with certain safety features to
   prevent problems.

Copyright

   Copyright (C) The Internet Society 1999.  All Rights Reserved.

Showalter                 Expire in Six Months                  [Page 1]

Internet DRAFT         Sieve: Vacation Extension       February 15, 1999

0. Meta-information on this draft

   This information is intended to facilitate discussion.  It will be
   removed when this document leaves the Internet-Draft stage.

0.1. Discussion

   This draft is intended to be an extension to the Sieve mail filtering
   language, avaliable from the Internet-Drafts repository as
   <ftp://ftp.ietf.org/internet-drafts/draft-showalter-sieve-06.txt>
   (where 06 is the version number, which is actually currently 06).

   This draft and the Sieve language itself are being discussed on the
   MTA Filters mailing list at <[email-masked]>.  Subscription
   requests can be sent to <[email-masked]> (send an
   email message with the word "subscribe" in the body).  More
   information on the mailing list along with a WWW archive of back
   messages is available at <http://www.imc.org/ietf-mta-filters/>.

1. Introduction

   This is an extension to the Sieve language defined by [SIEVE] for
   notification that messages will not be immediately answered.

   Conventions for notations are as in [SIEVE] section 1.1, including
   use of [KEYWORDS].

2. Capability Identifier

   Sieve implementations that implement vacation have an identifier of
   "VACATION" for use with the capability mechanism.

3. Vacation Action

   Syntax:   vacation [":days" number] [":addresses" string-list]
             <reason: string>

   The "vacation" action implements a vacation autoresponder similar to
   the vacation command  available under many versions of Unix.  Its
   purpose is to provide correspondents with notification that the user
   is away for an extended period of time and that they should not
   expect quick responses.

   "Vacation" is used to respond to a message with another message.
   Vacation's messages are always addressed to the Return-Path address
   (that is, the envelope from address) of the message being responded
   to.

Showalter                 Expire in Six Months                  [Page 3]

Internet DRAFT         Sieve: Vacation Extension       February 15, 1999

   The ":days" argument is used to specify the period in which addresses
   are kept and are not responded to, and is always specified in days.
   The minimum and default value is 7.

   "Vacation" keeps track of all of the addresses that it has responded
   to in some period (as specified by the :days optional argument).  If
   vacation has not previously responded to this address within that
   time period, it sends the "reason" argument to the Return-Path
   address of the message that is being responded to.

   "Vacation" never responds to a message unless the user's email
   address is in the "To" or "Cc" line of the original message.
   Implementations are assumed to be able to know this information, but
   users may have additional addresses beyond the control of the local
   mail system.

   Users can supply additional mail addresses that are theirs with the
   ":addresses" argument, which takes a string-list listing additional
   addresses that a user might have.

   Example:
             vacation :days 23 :addresses ["[email-masked]", "[email-masked]"]
                "I'm away until October 19.  If it's an emergency, call
                911, I guess." ;

   By mingling vacation with other rules, users can do something more
   selective.

   Example:
             if header :contains "from" "[email-masked]" {
                forward "[email-masked]";
             } else {
                if header :contains ["to", "cc"] "[email-masked]" {
                  vacation "Sorry, I'm away, I'll read your message when
                I get around to it.";
             }

4. Interaction with Other Sieve Actions

   Vacation does not affect the implicit keep.

   Vacation may not be used with reject.

Showalter                 Expire in Six Months                  [Page 4]

Internet DRAFT         Sieve: Vacation Extension       February 15, 1999

5. Security Considerations

   It is critical that implementations correctly implement the
   limitations described above: Replies MUST NOT be sent out in response
   to messages not sent directly to the user, and replies MUST NOT be
   sent out more often than the :days argument states.

6. Author's Address

   Tim Showalter
   Carnegie Mellon University
   5000 Forbes Avenue
   Pittsburgh, PA 15213

   E-Mail: [email-masked]

Showalter                 Expire in Six Months                  [Page 5]

Internet DRAFT         Sieve: Vacation Extension       February 15, 1999

Appendix A.  References

   [KEYWORDS] Bradner, S., "Key  words  for  use  in  RFCs  to  Indicate
   Requirement Levels", RFC 2119, Harvard University, March 1997.

   [SIEVE] Showalter, T.,  "Sieve: A Mail Filtering Language",  Carnegie
   Mellon, Work in Progress.

Appendix B. Full Copyright Statement

   Copyright (C) The Internet Society 1999. All Rights Reserved.

   This document and translations of it may be copied and  furnished  to
   others,  and derivative works that comment on or otherwise explain it
   or assist in its implementation may be  prepared,  copied,  published
   and  distributed,  in  whole  or  in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included  on  all  such  copies  and derivative works.  However, this
   document itself may not be modified in any way, such as  by  removing
   the  copyright  notice or references to the Internet Society or other
   Internet  organizations,  except  as  needed  for  the   purpose   of
   developing  Internet  standards  in  which  case  the  procedures for
   copyrights  defined  in  the  Internet  Standards  process  must   be
   followed,  or  as  required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will  not  be
   revoked by the Internet Society or its successors or assigns.

This document will expire before 31 July 1999.

Showalter                 Expire in Six Months                  [Page 6]


--Multipart_Mon_Feb_15_15:40:08_1999-1--

Date: 15 Feb 1999 15:37:26 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: sieve vacation draft
Sender: [email-masked]

Hi.  This is a second stab at a vacation extension.  Please take a look at it.

Lowlights: I'm not satisfied with section 4.  If someone can suggest
good wording for both the base document and section 4 in this document
that makes action interactions clear, I'd really appreciate it.
Otherwise the interactions are going to be very badly defined and
implemented.

Tim

Date: Sat, 13 Feb 1999 14:12:53 -0500
From: Tony Hansen <[email-masked]>
Organization: AT&T Laboratories
To: [email-masked]
Subject: Re: sieve-06bis
Sender: [email-masked]

Tim Showalter wrote:
> 
> Hi.  This draft has some of the changes folks have asked for.  Notably
> missing are the things Steve posted that I wasn't sure about, noted in
> my previous message, and anything related to multiple fileinto.

A few typos and mostly minor comments.

	Tony Hansen
	[email-masked]

===

   All implementations MUST support the "i;octet" comparator (simply
   compares octets) and the "i;ascii-casemap" comparator (which treats
   uppercase and lowercase English characters in the same).  If left
                                              ^^ as
   unspecified, the default is "i;ascii-casemap".

===

   Actions that do not affect delivery status can be used multiple times
   and in any combination with each other.  In the base draft, this
                                                               ^^^^ these
   actions are "fileinto" and "redirect".

===

As I was reading section 4, I kept wondering what the "require" string
was supposed to be for each of the optional commands. I suggest adding
that information to each section of an action that is optional.

   Because some implementations cannot implement the reject command, it
   is optional.
               ^^ The string to be used for the require command is "reject".

===

   The "fileinto" action drops the message into a named folder.
   Implementations SHOULD support fileinto, but in some environments
   this may be impossible.
                          ^^ The string to be used for the require command
                             is "fileinto".

===

   The require action notes that a script makes use of an certain
   extension.  Such a declaration is required to use the extension, as
   discussed in section 2.10.2.  Multiple capabilities can be declared
                        ^^^^^^ 2.10.5
   with a single require.

===

   Example:  require ["fileinto", "envelope"];
                                   ^^^^^^^^ "reject".

What is "envelope" supposed to represent? The envelope test is not
optional, or if it is, it's not marked as such.

===

5.4.     Test envelope

This section is written strictly in terms of SMTP. Other transfer protocols
do exist and should not be dismissed.

===

   The "envelope" test is true if the specified part of the RFC-822
                                                            ^^^^^^^ SMTP (or equivalent)
   envelope matches the specified key.

If an RFC were to be mentioned, it should be 821, not 822. Besides, the
SMTP protocol RFC821 is being rewritten, so refering to a particular RFC
is not recommended.

===

   If one of the envelope-part strings is (case insensitive) "from",
   then matching occurs against the FROM address used in the SMTP MAIL
   command.
          ^^, or equivalent

   If one of the envelope-part strings is (case insensitive) "to", then
   matching occurs against the TO address used in the SMTP RCPT command
                                                                       ^^, or equivalent,
   that resulted in this message getting delivered to this user.  Note
   that only the most recent TO is avaliable.

===

The Test address and Test envelope sections need examples:

   Example:     if address :all "from" :is "[email-masked]" {
                      discard;
                }

   Example:     if envelope :all "from" :is "[email-masked]" {
                      discard;
                }

===

7.      Transmission

   The MIME type for a Sieve script is "application/sieve".

This needs the complete registration section from the MIME documents (RFC 2048). Suggested text follows:

     Subject: Registration of MIME media type applicaton/sieve

     MIME media type name: application
     MIME subtype name: sieve
     Required parameters: none
     Optional parameters: none
     Encoding considerations: Most sieve scripts will be textual, written in UTF-8.
        When non-7bit characters are used, quoted-printable would be appropriate for transport
        systems that require 7bit encoding.
     Security considerations: Discussed in section 10 of RFC XXXX.
     Interoperability considerations: Discussed in section 2.10.5 of RFC XXXX.
     Published specification: RFC XXXX.
     Applications which use this media type: sieve-enabled mail servers
     Additional information:
       Magic number(s):
       File extension(s): .siv
       Macintosh File Type Code(s):
     Person & email address to contact for further information:
	See the discussion list at [email-masked].
     Intended usage:
	COMMON
     Author/Change controller:
	See Author information in RFC XXXX.

Date: 11 Feb 1999 15:11:44 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: sieve-06bis
Sender: [email-masked]

--Multipart_Thu_Feb_11_15:11:43_1999-1
Content-Type: text/plain; charset=US-ASCII

Hi.  This draft has some of the changes folks have asked for.  Notably
missing are the things Steve posted that I wasn't sure about, noted in
my previous message, and anything related to multiple fileinto.

Tim

--Multipart_Thu_Feb_11_15:11:43_1999-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="sieve.txt"
Content-Transfer-Encoding: 7bit

Network Working Group                                       T. Showalter
Internet Draft: Sieve                                    Carnegie Mellon
Document: draft-showalter-sieve-06bis.txt              February 11, 1999
Expire in six months

                    Sieve: A Mail Filtering Language

Status of this memo

   This document is an Internet-Draft.  Internet-Drafts are working
   documents of the Internet Engineering Task Force (IETF), its areas,
   and its working groups.  Note that other groups may also distribute
   working documents as Internet-Drafts.

   Internet-Drafts are draft documents valid for a maximum of six months
   and may be updated, replaced, or obsoleted by other documents at any
   time.  It is inappropriate to use Internet-Drafts as reference
   material or to cite them other than as ``work in progress.''

   To learn the current status of any Internet-Draft, please check the
   ``1id-abstracts.txt'' listing contained in the Internet-Drafts Shadow
   Directories on ftp.is.co.za (Africa), ftp.nordu.net (Europe),
   munnari.oz.au (Pacific Rim), ds.internic.net (US East Coast), or
   ftp.isi.edu (US West Coast).

   The protocol discussed in this document is experimental and subject
   to change.  Persons planning on either implementing or using this
   protocol are STRONGLY URGED to get in touch with the author before
   embarking on such a project.

Copyright Notice

   Copyright (C) The Internet Society 1999.  All Rights Reserved.

Abstract

   This document describes a mail filtering language for filtering
   messages at time of final delivery.  It is designed to be independent
   of protocol, and implementable on either a mail client or mail
   server.  It is meant to be extensible, simple, and independent of
   access protocol, mail architecture, and operating system.  It is
   suitable for running on a mail server where users may not be allowed
   to execute arbitrary programs, such as on black box IMAP servers, as
   it has no variables, loops, or ability to shell out to external
   programs.

Showalter                 Expire in Six Months                  [Page 1]

Internet DRAFT                   Sieve                 February 11, 1999

                           Table of Contents

Status of this memo ...............................................    1
Copyright Notice ..................................................    1
Abstract ..........................................................    1
0.      Meta-information on this draft ............................    4
0.1.     Discussion ...............................................    4
0.2.     Known Problems ...........................................    4
0.2.1.   Probable Extensions ......................................    4
0.2.2.   Known Bugs ...............................................    4
0.3.     Noted Changes ............................................    5
0.3.1.   since -06 ................................................    5
0.3.2.   since -05 ................................................    5
0.3.3.   since -04 ................................................    6
1.      Introduction ..............................................    8
1.1.     Conventions Used in This Document ........................    8
1.2.     Example mail messages ....................................    9
2.      Design ....................................................   10
2.1.     Form of the Language .....................................   10
2.2.     Whitespace ...............................................   10
2.3.     Comments .................................................   10
2.4.     Literal Data .............................................   11
2.4.1.   Numbers ..................................................   11
2.4.2.   Strings ..................................................   11
2.4.2.1. String Lists .............................................   12
2.4.2.2. Headers ..................................................   12
2.4.2.3. Addresses ................................................   12
2.5.     Tests ....................................................   13
2.5.1.   Test Lists ...............................................   13
2.6.     Arguments ................................................   13
2.6.1.   Positional Arguments .....................................   13
2.6.2.   Tagged Arguments .........................................   13
2.6.3.   Optional Arguments .......................................   14
2.6.4.   Types of Arguments .......................................   14
2.7.     String Comparison ........................................   14
2.7.1.   Match Type ...............................................   15
2.7.2.   Comparisons across Character Sets ........................   16
2.7.3.   Comparators ..............................................   16
2.7.4.   Comparisons against addresses ............................   17
2.8.     Blocks ...................................................   17
2.9.     Commands .................................................   18
2.10.    Evaluation ...............................................   18
2.10.1.  Mutually Exclusive Delivery Actions ......................   18

Showalter                 Expire in Six Months                  [Page 2]

Internet DRAFT                   Sieve                 February 11, 1999

2.10.2.  Implicit Keep ............................................   18
2.10.3.  Message Uniqueness in a Mailbox ..........................   19
2.10.4.  Limits on Numbers of Actions .............................   19
2.10.5.  Extensions and Optional Features .........................   19
3.      Control Commands ..........................................   19
4.      Action Commands ...........................................   21
4.1.     Action reject ............................................   21
4.2.     Action fileinto ..........................................   22
4.3.     Action redirect ..........................................   22
4.4.     Action keep ..............................................   22
4.5.     Action stop ..............................................   23
4.6.     Action discard ...........................................   23
4.7.     Action require ...........................................   23
5.      Test Commands .............................................   24
5.1.     Test address .............................................   24
5.2.     Test allof ...............................................   24
5.3.     Test anyof ...............................................   25
5.4.     Test envelope ............................................   25
5.5.     Test exists ..............................................   26
5.6.     Test false ...............................................   26
5.7.     Test header ..............................................   26
5.8.     Test not .................................................   27
5.9.     Test size ................................................   27
6.      Extensibility .............................................   27
6.1.     Capability String ........................................   28
6.2.     Registry .................................................   28
6.3.     Capability Transport .....................................   29
7.      Transmission ..............................................   29
8.      Acknowledgments ...........................................   29
9.      Parsing ...................................................   29
9.1.     Lexical Tokens ...........................................   29
9.2.     Grammar ..................................................   30
10.     Security Considerations ...................................   31
11.     Author's Address ..........................................   32
Appendix A.  References ...........................................   32
Appendix B.  Full Copyright Statement .............................   32

Showalter                 Expire in Six Months                  [Page 3]

Internet DRAFT                   Sieve                 February 11, 1999

Showalter                 Expire in Six Months                  [Page 2]

Internet DRAFT                   Sieve                 February 11, 1999

0.      Meta-information on this draft

   This information is intended to facilitate discussion.  It will be
   removed when this document leaves the Internet-Draft stage.

0.1.     Discussion

   This draft is being discussed on the MTA Filters mailing list at
   <[email-masked]>.  Subscription requests can be sent to
   <[email-masked]> (send an email message with the
   word "subscribe" in the body).  More information on the mailing list
   along with a WWW archive of back messages is available at
   <http://www.imc.org/ietf-mta-filters/>.

0.2.     Known Problems

0.2.1.   Probable Extensions

   The following suggestions have been made, and will probably be
   addressed by extensions.

   An extension for regular expressions will be written.  While regular
   expressions are of questionable utility for most users, the
   programmers writing implementations desperately want regular
   expressions.

   "Detailed" addressing or "sub-addressing" (i.e., the "foo" in an
   address "[email-masked]") is not handled, and will be moved
   to an extension for those systems that offer it.

   A vacation command has been requested for an extension; a preliminary
   draft exists and will be submitted to the internet-drafts repository.
   Vacation functionality is isn't in the draft because having vacation
   assumes you can store the addresses of people who have already
   received vacation notifications, which isn't always the case.

   A suggestion was made to set IMAP flags on delivery (e.g., \Flagged,
   \Deleted, \Answered, \Seen).

   An "include" command is not included, but has been suggested for an
   extension.

0.2.2.   Known Bugs

   I have punted on multiple fileinto.

   The title of 2.10.1 is probably open for suggestions.  Given the
   existance of DSNs and the similarity of names, I'm not happy with it.

Showalter                 Expire in Six Months                  [Page 4]

Internet DRAFT                   Sieve                 February 11, 1999

0.3.     Noted Changes

0.3.1.   since -06

   Larry Greenfield supplied a rewrite of the grammar that seperates
   things out into a tokenizer and a parser.  This grammar also allows
   UTF-8 characters in strings (previous versions limited characters to
   the 0x01-0x7F range).

   Steve Hole made a number of editorial suggestions that were taken.
   This includes discussing a tokenizer in 2.1 and renaming sections 3,
   4, and 5 ("Control Structures" became "Control Commands", "Actions"
   became "Action Commands", and "Tests" became "Test Commands").  Other
   uses of these terms in this document should have been changed to
   match, but I probably missed some.

   Lots of new rules were added to section 2.10, and should be reviewed
   carefully.  I hope that they reflect consensus, but am not sure.
   None of these are probably the changes that Steve Hole were asking
   for, but I thought that section was the appropriate place for them
   anyway.

   The copyright date has been fixed.

0.3.2.   since -05

   Draft -05 was never published in the Internet-Drafts repository, but
   was circulated on the [email-masked] mailing list.

   All nits submitted by Greg Sereda are hopefully addressed.  Most of
   these were example bugs, but he also pointed out that types for
   arguments were under-specified and in several cases orders of
   arguments disagreed with the syntax.

   "Match keyword" was changed to "match type" as an editorial change.

   "Forward" was renamed to "redirect" because of the conflict between
   mutliple meanings of "forward" in order to make it clear exactly what
   we meant.

   Limitation of one redirect per message should be removed.

   The types of arguments have been added to their syntax line.

   Added "require" back in a slightly different form.  "Require" is now
   an action (arbitrarily) and has been added to sec. 2.10 as well.

   Implementations are responsible for not allowing mail loops.

Showalter                 Expire in Six Months                  [Page 5]

Internet DRAFT                   Sieve                 February 11, 1999

   All discussion of short-circuit evaluation has been removed.  On a
   related note, tests must not have side effects.

   Envelope is required to drop source routes.

   An address-matching primitive has been added.

0.3.3.   since -04

   Here are a list of changes from draft 04.  (It may not be complete.)

   * Concensus: i;ascii-casemap is required.

   * Consensus: i;ascii-casemap is the default.

   * Header name compares are always case-insensitive; the draft now
     says so.

   * Several examples were fixed, but it is likely that errors remain.

   * Bug: Section 7, remove reference to "support".

   * There are two namespaces  for extension names, one "vnd.", one
     everything else, like MIME.

   * All XXXs have been removed, except for in IANA section.

   * Fileinto is optional, and discussion of local mail folders and POP3
     has been removed.

   * A non-present comparator is considered to be basically a syntax
     error.

   * Resent headers are not to be added by the "redirect" command.

   * Tagged arguments must follow the keyword, and may not be
     interspersed with positional arguments.

   * Envelope-matching commands are to be added with the syntax that
     Barry suggested.

   * Put back :matches match type.

   * What happens when an error occurs has been dropped.

   * Reject is now optional.

   * Implementations are encouraged to decode header charsets, and if

Showalter                 Expire in Six Months                  [Page 6]

Internet DRAFT                   Sieve                 February 11, 1999

     they don't, are required to not do compares on 8-bit data.

Showalter                 Expire in Six Months                  [Page 7]

Internet DRAFT                   Sieve                 February 11, 1999

1.      Introduction

   This memo documents a language that can be used to create filters for
   electronic mail. It is not tied to any particular operating system or
   mail architecture.  It requires the use of [IMAIL]-compliant
   messages, but otherwise should generalize to other systems that meet
   these criteria.

   The language is powerful enough to be useful, but limited in power in
   order to allow for a safe server-side filtering system.  The
   intention is to make it impossible for users to do anything more
   complex (and dangerous) than write simple mail filters, along with
   facilitating GUI-based editors. The language is not Turing-complete,
   and provides no way to write a loop or a function.  Variables are not
   provided.

   Implementations of the language are expected to take place at time of
   final delivery, when the message is moved to the user-accessible
   mailbox.  In systems where the MTA does final delivery, such as
   traditional UNIX mail, it is reasonable to sort when the MTA deposits
   mail into the user's mailbox.

   There are a number of reasons to use a filtering system.  Mail
   traffic for most users has been increasing due both to increased
   usage of e-mail, the emergence of unsolicited email as a form of
   advertising, and increased usage of mailing lists.

   Experience at Carnegie Mellon has shown that if a filtering system is
   made available to users, many will make use of it in order to file
   messages from specific users or mailing lists.  However, many others
   did not make use of the Andrew system's FLAMES [FLAMES] filtering
   language due to difficulty in setting it up.

   Because of the expectation that users will make use of filtering if
   it is offered and easy to use, this language has been made simple
   enough to allow many users to make use of it, but rich enough that it
   can be used productively.  However, it is expected that GUI-based
   editors will be the preferred way of editing filters for a large
   number of users.

1.1.     Conventions Used in This Document

   In the sections of this document that discuss the requirements of
   various keywords and operators, the following conventions have been
   adopted.

   The key words "MUST", "MUST NOT", "SHOULD", "SHOULD NOT", "CAN", and
   "MAY" in this document are to be interpreted as defined in

Showalter                 Expire in Six Months                  [Page 8]

Internet DRAFT                   Sieve                 February 11, 1999

   [KEYWORDS].

   Each section on a test, action, or control structure has a line
   labeled "Syntax:".  This line describes the syntax of the command,
   including its name and its arguments.  Required arguments are listed
   inside angle brackets ("<" and ">").  Optional arguments are listed
   inside square brackets ("[" and "]").  Each argument is followed by
   its type, so "<key: string>" represents an argument called "key" that
   is a string.  Literal strings are represented with double-quoted
   strings.  Alternatives are seperated with slashes, and parenthesis
   are used for grouping, similar to [ABNF].

   In the "Syntax" line, there are three special pieces of syntax that
   are frequently repeated, MATCH-TYPE, COMPARATOR, and ADDRESS-PART.
   These are discussed in sections 2.7.1, 2.7.3, and 2.7.4,
   respectively.

   The formal grammar for these commands in section 10 and is the
   authoritative reference on how to construct commands, but the formal
   grammar does not specify the order, semantics, number or types of
   arguments to commands, nor the legal command names.  The intent is to
   allow for extension without changing the grammar.

1.2.     Example mail messages

   The following mail messages will be used throughout this document  in
   examples.

   Message A
   -----------------------------------------------------------
   Date: Tue, 1 Apr 1997 09:06:31 -0800 (PST)
   From: [email-masked]
   To: [email-masked]
   Subject: I have a present for you

   Look, I'm sorry about the whole anvil thing, and I really
   didn't mean to try and drop it on you from the top of the
   cliff.  I want to try to make it up to you.  I've got some
   great birdseed over here at my place--top of the line
   stuff--and if you come by, I'll have it all wrapped up
   for you.  I'm really sorry for all the problems I've caused
   for you over the years, but I know we can work this out.
   --
   Wile E. Coyote       "Super Genius"        [email-masked]
   -----------------------------------------------------------

Showalter                 Expire in Six Months                  [Page 9]

Internet DRAFT                   Sieve                 February 11, 1999

   Message B
   -----------------------------------------------------------
   From: youcouldberich!@reply-by-postal-mail
   Sender: [email-masked]
   To: [email-masked]
   Date:  Mon, 31 Mar 1997 18:26:10 -0800 (PST)
   Subject: $$$ YOU, TOO, CAN BE A MILLIONAIRE! $$$

   YOU MAY HAVE ALREADY WON TEN MILLION DOLLARS, BUT I DOUBT
   IT!  SO JUST POST THIS TO SIX HUNDRED NEWSGROUPS!  IT WILL
   GUARANTEE THAT YOU GET AT LEAST FIVE RESPONSES WITH MONEY!
   MONEY! MONEY! COLD HARD CASH!  YOU WILL RECEIVE OVER
   $20,000 IN LESS THAN TWO MONTHS!  AND IT'S LEGAL!!!!!!!!!
   !!!!!!!!!!!!!!!!!!111111111!!!!!!!11111111111!!1  JUST
   SEND $5 IN SMALL, UNMARKED BILLS TO THE ADDRESSES BELOW!
   -----------------------------------------------------------

2.      Design

2.1.     Form of the Language

   The language consists of a set of commands.   Each command consists
   of a set of tokens delimited by whitespace.   The first token is the
   command string followed by zero or more arguments.  Arguments may be
   literal data, tags, blocks of commands, or test commands.

   The language is represented in UTF-8, as specified in [UTF-8].

2.2.     Whitespace

   Whitespace is used to separate tokens.  Whitespace is made up of
   tabs, newlines (CRLF, never just CR or LF), and the space character.
   The amount of whitespace used is not significant.

2.3.     Comments

   Comments begin with a "#" character that is not contained within a
   string and continue until the next CRLF.  Comments are semantically
   equivalent to whitespace and are permitted to be used anyplace that
   whitespace is (with one exception in multi-line strings).

   Example:  if size :over 100K { # this is a comment
                discard;
             }

Showalter                 Expire in Six Months                 [Page 10]

Internet DRAFT                   Sieve                 February 11, 1999

2.4.     Literal Data

   Literal data means data that is not executed, merely evaluated "as
   is", to be used as arguments to commands.  Literal data is limited to
   numbers and strings.

2.4.1.   Numbers

   Numbers are given as ordinary decimal numbers.  However, those
   numbers that have a tendency to be fairly large, such as message
   sizes, MAY have a "K", "M", or "G" appended to indicate a multiple of
   a base-two number.  To be comparable with the power-of-two-based
   versions of SI units that computers frequently use, K specifies kilo,
   or 1,024 (2^10) times the value of the number; M specifies mega, or
   1,048,576 (2^20) times the value of the number; and G specifies giga,
   or 1,073,741,824 (2^30) times the value of the number.

   Implementations MUST provide 31 bits of magnitude in numbers, but may
   provide more.

   Negative, fractional, and decimal numbers are not permitted  by  this
   specification.

2.4.2.   Strings

   Scripts involve large numbers of strings, as they are used for
   pattern matching, addresses, and textual bodies, etc.  Typically,
   short quoted strings suffice for most uses, but a more convenient
   form is provided for longer strings such as bodies of messages.

   A quoted string starts and ends with a single double quote (the <">
   character, ASCII 34).  A backslash ("\", ASCII 92) inside of a quoted
   string is followed by either another backslash or a double quote.
   This two-character sequence represents a single backslash or double-
   quote within the string, respectively.

   Other escape sequences may be permitted depending on context.  An
   undefined escape sequence (such as "\a" in a context where "a" has no
   special meaning) is interpreted as if there were no backslash (in
   this case, "\a" is just "a").

   Non-printing characters such as tabs, CR and LF, and control
   characters are permitted in strings.  NUL (ASCII 0) is not allowed in
   strings.

   For entering larger amounts of text, such as an email message, a
   multi-line form is allowed.  It starts with the keyword "text:",
   followed by a CRLF, and ends with the sequence of a CRLF, a single

Showalter                 Expire in Six Months                 [Page 11]

Internet DRAFT                   Sieve                 February 11, 1999

   period, and another CRLF.  In order to allow the message to begin
   lines with a single-dot, lines are dot-stuffed.  That is, when
   composing a message body, an extra `.' is added before each line
   which begins with a `.'.  When the server interprets the script,
   these extra dots are removed.

   Note that a comment may occur in between the "text:" and the CRLF,
   but not within the string itself.

2.4.2.1. String Lists

   When matching patterns, strings frequently come in groups.  For this
   reason, a list of strings is allowed in many tests, implying that if
   the test is true using any one of the strings, then the test is true.
   Implementations are encouraged to use short-circuit evaluation in
   these cases.

   For instance, the test `header :contains ["To", "Cc"]
   ["[email-masked]", "[email-masked]"]' is true if either the
   To header or Cc header of the input message contains either of the
   e-mail addresses "[email-masked]" or "[email-masked]".

   Conversely, in any case where a list of strings would be appropriate,
   a single string is allowed without being a member of a list; it is
   equivalent to a list with a single member.  So the test `exists "To"'
   is equivalent to the test `exists ["To"]'.

2.4.2.2. Headers

   Headers are a subset of strings.  In the Internet Message
   Specification [IMAIL], each header line is allowed to have whitespace
   nearly anywhere in the line, including after the field name and
   before the subsequent colon.  Extra spaces between the header name
   and the ":" in a header field are ignored by the interpreter.

   A header name never contains a colon.  The "From" header refers to a
   line beginning "From:" (or "From   :", etc.).  No header will match
   the string "From:" due to the trailing colon.

2.4.2.3. Addresses

   A number of commands call for email addresses, which are also a
   subset of strings.  These addresses must be compliant with [IMAIL].
   Implementations MUST ensure that the addresses are syntactically
   valid, but need not ensure that they are actually deliverable.

Showalter                 Expire in Six Months                 [Page 12]

Internet DRAFT                   Sieve                 February 11, 1999

2.5.     Tests

   Tests are given as arguments to commands in order to control how the
   run.  Generally, a test is used to decide if a block of code should
   be evaluated.

   Tests MUST NOT have side effects.  That is, a test must not make
   changes to state.  No tests in this specification have side effects,
   and side effects are forbidden in extensions as well.

   Note:  Tests with side effects impair readability and maintainability
          and are difficult to represent in a graphic interface to
          generating scripts, so side effects have been confined to
          actions where they are clearer.

2.5.1.   Test Lists

   Some tests (allof and anyof, which implement logical and and or,
   respectively) need to take more than a single test as an argument.
   The test-list syntax element provides a way of grouping tests.

   Example:  if any-of (not exists ["From", "Date"],
                   header :contains "from" "[email-masked]") {
                discard;
             }

2.6.     Arguments

   In order to specify how they function, most commands take arguments.
   There are three types of arguments: positional, tagged, and optional.

2.6.1.   Positional Arguments

   Positional arguments are given to a command which discerns their
   meaning based on their order.  When a command takes positional
   arguments, all positional arguments must be supplied, and must be in
   the order prescribed.

2.6.2.   Tagged Arguments

   This document provides for tagged arguments in the style of
   CommonLISP.  These are also similar to flags given to commands in
   most command-line systems.

   A tagged argument is an an argument for a command that begins with
   ":", and consists of a tag naming the argument, such as ":contains".
   This argument means that zero or more of the next tokens have some

Showalter                 Expire in Six Months                 [Page 13]

Internet DRAFT                   Sieve                 February 11, 1999

   particular meaning, depending on the argument.  These next tokens may
   be numbers or strings, but are never blocks.

   So tagged arguments are similar to positional arguments, except that
   instead of the meaning being derived from the command, it is derived
   from the tag.

   Tagged arguments must appear before positional arguments, but they
   may appear in any order.  For convienence, this is not expressed in
   the syntax definitions with commands, but they still may be reordered
   arbitrarily provided they appear before positional arguments.  Tagged
   arguments may be mixed with optional arguments.

   To keep the language simple, tagged arguments should not take tagged
   arguments as arguments.

2.6.3.   Optional Arguments

   Optional arguments are exactly like tagged arguments except that they
   may be left out, in which case a default value is implied.  Because
   optional arguments tend to result in shorter scripts, they have been
   used far more than tagged arguments.

   One particularly noteworthy case is the ":comparator" argument, which
   allows the user to specify which ACAP comparator will be used to
   compare two strings, since different languages may impose different
   orderings on UTF-8 [UTF-8] characters.

2.6.4.   Types of Arguments

   Abstractly, arguments may be literal data, tests, or blocks of
   commands.  In this way, an "if" control structure is merely a command
   that happens to take a test and a block as arguments and may execute
   the block of code.

   However, this abstraction is ambiguous from a parsing standpoint.
   The grammar in section 9.2 presents a parsable version of this:
   arguments are string-lists, numbers, and tags, which may be followed
   by a test or a test-list, which may be followed by a block of
   commands.  No more than one test or test list, nor more than one
   block of commands, may be used, and commands that end with blocks of
   commands do not end with semicolons.

2.7.     String Comparison

   When matching one string against another, there are a number of ways
   of performing the match.  These are accomplished with three types of
   matches:  exact match, a substring match, and a wildcard glob-style

Showalter                 Expire in Six Months                 [Page 14]

Internet DRAFT                   Sieve                 February 11, 1999

   match.  In order to provide for matches between character sets and
   case insensitivity, Sieve borrows ACAP's comparator registry.

   However, when a string is being used to represent the name of a
   header, the comparator is never user-specified.  Header comparisons
   are always done in a case-insensitive manner, since this is the way
   things are specified in the message specification [IMAIL].  That is,
   header-name comparisons are always done with the "i;ascii-casemap"
   comparator.

2.7.1.   Match Type

   There are three allowed match types describing the allowed match in
   this draft: they are ":is", ":contains", and ":matches".  Match type
   are supplied to those commands which allow them to specify whether
   the match is to be a complete match or not.

   These are used as tagged arguments to tests that perform string
   comparison.  Exactly one of them is necessary for a command.

   The ":contains" version describes a substring match.  If the value
   argument contains the key argument as a substring, the match is true.
   For instance, the string "frobnitzm" contains "frob" and "nit", but
   not "fbm".  The null key ("") is contained in all values.

   The ":is" version describes an absolute match; if the contents of the
   first string are absolutely the same as the contents of the second
   string, they match.  Only the string "frobnitzm" is the string
   "frobnitzm".  The null key only ":is" the null value.

   The ":matches" version specifies a wildcard match using the
   characters "*" and "?".  "*" matches any number of characters, and
   "?" matches a single character.  "?" and "*" may be escaped as "\?"
   and "\*" in strings to match against them by name.

   In order to specify  what  type  of  match  is  supposed  to  happen,
   commands   that  support  matching  take  optional  tagged  arguments
   ":matches", ":is", and ":contains".  Commands default to using  ":is"
   matching.   Note  that these modifiers may interact with comparators;
   in particular, some comparators are not suitable  for  matching  with
   ":contains"  or  ":matches".  It is an error to use a comparator with
   ":contains" or ":matches" that is not compatible with it.

   For convienence, the MATCH-TYPE syntax element  is  defined  here  as
   follows:

   Syntax:   [ < ":is" / ":contains" / ":matches" > <key: string> ]

Showalter                 Expire in Six Months                 [Page 15]

Internet DRAFT                   Sieve                 February 11, 1999

2.7.2.   Comparisons across Character Sets

   All Sieve scripts are represented in UTF-8, but messages may involve
   a number of character sets.  In order for comparisons to work across
   character sets, implementations SHOULD implement the following
   behavior:

      Implementations decode header charsets to UTF-8.  Two strings are
      considered equal if their UTF-8 representations are identical.
      Implementations should decode charsets represented in the forms
      specified by [MIME] for both message headers and bodies.
      Implementations must be capable of decoding US-ASCII, ISO-8859-1,
      the ASCII subset of ISO-8859-* character sets, and UTF-8.

   If implementations fail to support the above behavior, they MUST
   conform to the following:

      No two strings containing 8-bit data can be considered equal.

2.7.3.   Comparators

   In order to allow for character set-independent matches, the match
   type may be coupled with a comparator name.  Comparators are
   described for [ACAP]; a registry is defined for ACAP, and this
   specification uses that registry.

   ACAP defines multiple comparator types.  Only equality types are used
   in this specification.

   All implementations MUST support the "i;octet" comparator (simply
   compares octets) and the "i;ascii-casemap" comparator (which treats
   uppercase and lowercase English characters in the same).  If left
   unspecified, the default is "i;ascii-casemap".

   Some comparators may not be usable with substring matches; that is,
   they may only work with ":is".  It is an error to try and use a
   comparator with ":matches" or ":contains" that is not compatible with
   it.

   A comparator is specified with commands that support matching by the
   ":comparator" option.  This option is followed by a string providing
   the name of the comparator to be used.  For convienence, the syntax
   of a comparator is abbreviated to [COMPARATOR], and (repeated in
   several tests) is as follows:

   Syntax:   [ ":comparator" <comparator-name: string> ]

   So in this example,

Showalter                 Expire in Six Months                 [Page 16]

Internet DRAFT                   Sieve                 February 11, 1999

   Example:  if header :contains :comparator "i;octet" "Subject"
                "MAKE MONEY FAST" {
                   discard;
                }

   would discard any message with subjects like "You can MAKE MONEY
   FAST", but not "You can Make Money Fast", since the comparator used
   is not case-sensitive.

   If a comparator is not known to an implementation, it is treated in
   the same way as an unknown command or syntax error.

   Both ":matches" and ":contains" match type are compatible with the
   "i;octet" and "i;ascii-casemap" comparators and may be used with
   them.

2.7.4.   Comparisons against addresses

   Addresses are probably one of the most frequent representations as
   strings.  Because these are structured and being able to compare
   against the local-part or the domain of an address is useful, some
   tests that act exclusively on addresses take an additional optional
   argument that specifies what the test acts on.

   These optional arguments are ":localpart", ":domain", and ":all",
   which act on the local-part (left-side), the domain part (right-
   side), and the whole address.

   The kind of comparison is done, such as whether or not the comparison
   done is case-insensitive, is specified as a comparator argument to
   the test.

   Syntax:   < ":localpart" / ":domain" / ":all" > ":localpart"

2.8.     Blocks

   Blocks are sets of commands enclosed within curly braces.  Blocks are
   supplied to commands so that the commands can implement control
   commands.

   So a control structure is just a command that happens to take a test
   and a block as its arguments; depending on the result of the control
   structure, it runs the code in the block zero or more times.  (Note
   that by the commands supplied in the specification, there are no
   loops, so the control structures supplied--if, elsif, and else--run a

Showalter                 Expire in Six Months                 [Page 17]

Internet DRAFT                   Sieve                 February 11, 1999

   block either once or not at all.)

2.9.     Commands

   Sieve scripts are sequences of commands.  Commands can take any of
   the tokens above as arguments, and arguments may be either tagged or
   positional arguments.

   There are three kinds of commands, test commands, action commands,
   and control commands.

   The simplest is an action command.  An action command is an
   identifier followed by zero or more arguments, terminated by a
   semicolon.  Action commands do not take tests or blocks as arguments.

   A control command is similar, but it takes a test as an argument, and
   ends with a block instead of a semicolon.

   A test command is used as part of a control command.  It is used to
   specify whether or not the block of code given to the control command
   is executed.

2.10.    Evaluation

2.10.1.  Mutually Exclusive Delivery Actions

   Actions that do not affect delivery status can be used multiple times
   and in any combination with each other.  In the base draft, this
   actions are "fileinto" and "redirect".

   Only one action that affects delivery status may be taken.  An
   attempt to run more than one such action leads to a run-time error,
   which has undefined behavior.  In the base draft, these actions are
   "keep", "discard", and "reject".
2.10.2.  Implicit Keep

   Previous experience with filtering systems suggests that cases tend
   to be missed in scripts.  To prevent massive errors, Sieve has an
   "implicit keep".

   An implicit keep is performed if a message is not written to a
   mailbox, redirected to a new address, or explicitally thrown out.
   That is, if a fileinto, a keep, a redirect, or a discard is
   performed, an implicit keep is not.

   For instance, with any of the short messages offered above, the
   following script produces no actions.

Showalter                 Expire in Six Months                 [Page 18]

Internet DRAFT                   Sieve                 February 11, 1999

   Example:  if size :over 500K { discard; }

   As a result, the implicit keep would be taken.

2.10.3.  Message Uniqueness in a Mailbox

   Implementations SHOULD NOT write a message to a mailbox where a copy
   of it already exists, even if a script explicitally asks for a
   message to be written to a mailbox twice.

   The test for equality of two messages is not defined by this memo.

2.10.4.  Limits on Numbers of Actions

   Site policy may limit numbers of actions taken.  In the event that a
   policy limits the number of actions taken on a particular message,
   the actions that are generated first in a script should be followed.

2.10.5.  Extensions and Optional Features

   Because of the differing capabilities of many mail systems, several
   features of this specification have been specified as optional.
   Before any of these extensions can be used, they must be declared
   with the "require" action.

   If an extension is not enabled with "require", implementations MUST
   treat it as if they did not support it at all.

   Note:  The reason for this restriction is that prior experiences with
          languages such as LISP and Tcl suggest that this is a workable
          way of noting that a given script uses an extension.

          Experience with languages such as PostScript that have
          extension mechanisms that allow a script to include
          information on how to work around a lack of an extension
          suggest that such mechanisms do not work well in practice.

3.      Control Commands

   In order for a script to do more than one set of actions, control
   structures are needed.  In Sieve, a control structure is a command
   that takes a block as an argument.

   In this document, only the "if" control structure is provided.  There
   are three pieces to if: "if", "elsif", and "else".

Showalter                 Expire in Six Months                 [Page 19]

Internet DRAFT                   Sieve                 February 11, 1999

   Syntax:   if <test1: test> <block1: block>

   Syntax:   elsif <test2: test> <block2: block>

   Syntax:   else <block>

   The semantics are similar to any other programming language this
   appears in.  When the interpreter sees an "if", it evaluates the test
   associated with it.  If the test is true, it executes the block
   associated with it.

   If the test of the "if" is false, it evaluates the test of the first
   "elsif" (if any).  If the test of "elsif" is true, it runs the
   elsif's block.  An elsif may be followed by an elsif, in which case,
   the interpreter repeats this process until it runs out of elsifs.

   When the interpreter runs out of elsifs, there may be an "else" case.
   If there is, and none of the if or elsif tests were true, the
   interpreter runs the else case.

   This provides a way of performing exactly one of the blocks in the
   chain.

   In the following example, both Message A and B are dropped.

   Example:  if header :contains "from" "coyote" {
                discard;
             } elsif :contains header ["subject"] ["$$$"] {
                discard;
             } else {
                fileinto "INBOX";
             }

   In the script below, when run over message A, redirects  the  message
   to  [email-masked];  message  B,  to [email-masked]; any
   other message is redirected to [email-masked].

   Example:  if header :contains ["From"] ["coyote"] {
                redirect "[email-masked]";
             } elsif header "Subject" contains "$$$" {
                redirect "[email-masked]";
             } else {
                redirect "[email-masked]";
             }

Showalter                 Expire in Six Months                 [Page 20]

Internet DRAFT                   Sieve                 February 11, 1999

4.      Action Commands

   This document supplies six actions that may be taken on a message:
   keep, fileinto, redirect, reject, discard, and stop.

4.1.     Action reject

   Syntax:   reject <reason: string>

   The optional "reject" action resends the message to the sender,
   wrapping it in a "reject" form, noting that it was rejected by the
   recipient.  In the following script, message A is rejected and
   returned to the sender.

   Example:  if header :contains "from" "[email-masked]" {
                reject "I am not taking mail from you, and I don't want
                your birdseed, either!";
             }

   A reject message MUST takes the form of a failed DSN as specified  by
   [DSN].    The  human-readable  portion  of  the  message,  the  first
   component of the DSN, contains the human readable message  describing
   the  error,  although  it SHOULD contain additional text alerting the
   original sender that mail was refused by a filter.  This part of  the
   DSN might appear as follows:

   ------------------------------------------------------------
   Message was refused by recipient's mail filtering program.
   Reason given was as follows:

   I am not taking mail from you, and I don't want your
   birdseed, either!
   ------------------------------------------------------------

   The action-value field as defined in the DSN specification MUST be
   "failed".

   A rejected message may not be filed, redirected, or kept.  A message
   that triggers a "reject" action is never allowed to be kept by the
   user, and the "reject" overrides all other actions.

   A message may only be rejected once.

   Because some implementations cannot implement the reject command, it
   is optional.

Showalter                 Expire in Six Months                 [Page 21]

Internet DRAFT                   Sieve                 February 11, 1999

4.2.     Action fileinto

   Syntax:   fileinto <folder: string>

   The "fileinto" action drops the message into a named folder.
   Implementations SHOULD support fileinto, but in some environments
   this may be impossible.

   In  the  following  script,  message   A   is   filed   into   folder
   "INBOX.harassment".

   Example:  if header :contains ["from"] "coyote" {
                fileinto "INBOX.harassment";
             }

4.3.     Action redirect

   Syntax:   redirect <address: string>

   The "redirect" action is used to send the message to another user at
   a supplied address, as a mail forwarding feature does.  The
   "redirect" action makes no changes to the message body or headers,
   and only modifies the envelope recipient.

   A simple script can be used for redirecting:

   Example:  redirect "[email-masked]";

   The redirect command performs an MTA-style "forward"--that  is,  what
   you  get from a .forward file using sendmail under UNIX.  The address
   on the SMTP envelope is replaced with the one on the redirect command
   and the message is sent back out.  (This is not an MUA-style forward,
   which creates a new message with a different sender and  message  ID,
   wrapping  the  old  message in a new one.)  The redirect command does
   not add Resent- headers.

4.4.     Action keep

   Syntax:   keep

   The "keep" action is whatever action is taken in lieu of all other
   actions, if no filtering happens at all; generally, this simply means
   to file the message into the user's main mailbox.  This command
   provides a way to execute this action without needing to know the
   name of the user's main mailbox, providing a way to call it without

Showalter                 Expire in Six Months                 [Page 22]

Internet DRAFT                   Sieve                 February 11, 1999

   needing to understand the user's setup, or the underlying mail
   system.

   Example:  if size :under 1M { keep; } else { discard; }

4.5.     Action stop

   Syntax:   stop

   The "stop" action ends all processing.  If no actions have been
   executed, then the keep action is taken.

4.6.     Action discard

   Syntax:   discard

   Discard drops the message.  In the following script, any mail from
   "[email-masked]" is thrown out.

   Example:  if header :contains ["from"] ["[email-masked]"] {
             discard; }

   Discard takes no arguments.

   While an important part of this language, "discard" has the potential
   to create serious problems for users: A student leaving themselves
   logged in to a machine in a computer lab may find their script
   changed to just "discard".  In order to protect users in this
   situation (along with similar situations), implementations MAY keep
   messages destroyed by a script for an indefinite period, and MAY
   disallow scripts that throw out all mail.

4.7.     Action require

   Syntax:   require <capabilities: string-list>

   The require action notes that a script makes use of an certain
   extension.  Such a declaration is required to use the extension, as
   discussed in section 2.10.2.  Multiple capabilities can be declared
   with a single require.

   Example:  require ["fileinto", "envelope"];

Showalter                 Expire in Six Months                 [Page 23]

Internet DRAFT                   Sieve                 February 11, 1999

5.      Test Commands

   Tests are used in conditionals to decide which part(s) of the
   conditional to execute.

5.1.     Test address

   Syntax:   address [ADDRESS-PART] [COMPARATOR] [MATCH-KEYWORD]
             <header-list: string-list> <key-list: string-list>

   The address test matches Internet addresses out of structured headers
   that contain addresses.  It returns true if any header contains any
   key in the specified part of the address, as modified by the
   comparator and the match keyword.

   Like envelope and header, this test returns true if any combination
   of the header-list and key-list arguments match.

   Internet email-addresses have the somewhat awkward characteristic
   that the mailbox-part [IMAIL] to the left of the at-sign is
   considered case sensitive, and the domain-part to the right of the
   at-sign is case insensitive.  The "address" command does not deal
   with this itself, but provides the ADDRESS-PART argument for allowing
   users to deal with it.

   The address primitive never acts on the phrase part of an email
   address, nor on comments within that address.  It also never acts on
   group names, although it does act on the addresses within the group
   construct.

   Implementations MUST restrict the address test to headers that
   contain addresses, but MUST include at least From, To, Cc, Bcc,
   Sender, Resent-From, Resent-To, and SHOULD include any other header
   that utilizes an "address-list" structured header body.

Showalter                 Expire in Six Months                 [Page 24]

Internet DRAFT                   Sieve                 February 11, 1999

5.2.     Test allof

   Syntax:   allof ( <test1: test>, <test2: test>, ..., <testN: test> )

   The allof test preforms a logical AND on the tests supplied to it.

   Example:  allof (false, false)  =>   false
             allof (false, true)   =>   false
             allof (true,  true)   =>   true

   The allof test takes as its argument a test-list.

5.3.     Test anyof

   Syntax:   anyof ( <test1: test> , <test2: test> , ..., <testN:  test>
             )

   The anyof test preforms a logical OR on the tests supplied to it.

   Example:  anyof (false, false)  =>   false
             anyof (false, true)   =>   true
             anyof (true,  true)   =>   true

5.4.     Test envelope

   Syntax:   envelope [ADDRESS-PART] [MATCH-KIND]
             <envelope-part: string-list> <key-list: string-list>

   The "envelope" test is true if the specified part of the RFC-822
   envelope matches the specified key.

   If one of the envelope-part strings is (case insensitive) "from",
   then matching occurs against the FROM address used in the SMTP MAIL
   command.

   If one of the envelope-part strings is (case insensitive) "to", then
   matching occurs against the TO address used in the SMTP RCPT command
   that resulted in this message getting delivered to this user.  Note
   that only the most recent TO is avaliable.

   The envelope-part is a string list and may contain both "from" and
   "to", in which case the strings specified in the key-list are matched
   against both parts of the envelope.

Showalter                 Expire in Six Months                 [Page 25]

Internet DRAFT                   Sieve                 February 11, 1999

   Like address and header, this test returns true if any combination of
   the envelope-part and key-list arguments is true.

   All tests against envelopes MUST drop source routes.

5.5.     Test exists

   Syntax:   exists <header-names: string-list>

   The "exists" test is true if the headers listed in the header-names
   argument exist within the message.  All of the headers must exist or
   the test is false.

   The following example throws out mail that doesn't have a From header
   and a Date header.

   Example:  if not :exists ["From","Date"] {
                discard;
             }

5.6.     Test false

   Syntax:   false

   The "false" test always evaluates to false.

5.7.     Test header

   Syntax:   header [COMPARATOR] [MATCH-TYPE]
             <header-names: string-list> <key-list: string-list>

   The "header" test evaluates to true if the any header name matches
   any key.  The type of match is specified by the optional match
   argument, which defaults to ":is" if not specified, as specified in
   section 2.6.

   Like address and envelope, this test returns true if any combination
   of the string-list and key-list arguments match.

Showalter                 Expire in Six Months                 [Page 26]

Internet DRAFT                   Sieve                 February 11, 1999

   If a header listed in the header-names argument exists,  it  contains
   the  null  key ("").  However, if the named header is not present, it
   does not contain the null key. So if a message contained the header

           X-Caffeine: C8H10N4O2

   these tests on that header evaluate as follows:

           header :is ["X-Caffeine"] [""]         => false
           header :contains ["X-Caffeine"] [""]   => true

5.8.     Test not

   Syntax:   not <test>

   The "not" test takes some other test as an argument, and yields the
   opposite result.

5.9.     Test size

   Syntax:   size <":over" / ":under"> <limit: number>

   The "size" test deals with the size of a message.  It takes either a
   tagged argument of ":over" or ":under", followed by a number
   representing the size of the message.

   If the argument is ":over", and the size of the message is greater
   than the number provided, the test is true; otherwise, it is false.

   If the argument is ":under", and the size of the message is less than
   the number provided, the test is true; otherwise, it is false.

   One of ":over" or ":under" must be specified.

   The size of a message is defined to be the number of octets from the
   initial header until the last character in the message body.

6.      Extensibility

   New control structures, actions, and tests can be added to the
   language.  Sites must make these features known to their users; this
   document does not define a way to discover the list of extensions
   supported by the server.

   Any extensions to this language MUST define a capability string that
   uniquely identifies that extension.  If a new version of an extension

Showalter                 Expire in Six Months                 [Page 27]

Internet DRAFT                   Sieve                 February 11, 1999

   changes the functionality of a previously defined extension, it MUST
   use a different name.

   In a situation where there is a submission protocol and an extension
   advertisement mechanism aware of the details of this language,
   scripts submitted can be checked against the mail server to prevent
   use of an extension that that the server does not support.

   Extensions should state how they interact with constrants defined in
   section 2.10 (for instance, whether they cancel the implicit keep, or
   if they change delivery status).

6.1.     Capability String

   Capability strings are typically short strings describing what
   capabilities are supported by the server.

   Capability strings beginning with "vnd." represent vendor-defined
   extensions.  Such extensions are not defined by Internet standards or
   RFCs, but are still registered with IANA in order to prevent
   conflicts.  Extensions starting with "vnd." should be followed by the
   name of the vendor, such as "vnd.acme.rocket-sled".

   The following capability strings are defined by this document:

   envelope    The string "envelope" indicates that the implementation
               supports the "envelope" command.

   fileinto    The string "fileinto" indicates that the implementation
               supports the "fileinto" command.

   reject      The string "reject" incidates that the implementation
               supports the "reject" command.

   comparator- The string "comparator-elbonia" is provided if the
               implementation supports the "elbonia" comparator.
               Therefore, all implementations have at least the
               "comparator-i;octet" capability.

6.2.     Registry

   In order to provide a standard set of extensions, a registry is
   provided by IANA.  Capability names may be registered on a first-
   come, first-served basis.  Extensions designed for interoperable use
   should be defined as standards track or IESG approved experimental

Showalter                 Expire in Six Months                 [Page 28]

Internet DRAFT                   Sieve                 February 11, 1999

   RFCs.

   To: [email-masked]
   Subject: Registration of new Sieve extension

   Capability name:
   Capability keyword:
   Capability arguments:
   Standards Track/IESG-approved experimental RFC number:
   Person and email address to contact for further information:

6.3.     Capability Transport

   As the range of mail systems that this draft is intended to apply to
   is quite large, a method of advertising which capabilities an
   implementation supports is difficult due to the wide range of
   possible implementations.  Such a mechanism, however, should have the
   following properties.

   (1)  The implementation can advertise the complete set of extensions
        that it supports.

   OPEN:   There needs to be a more complete description here,
           suggestions appreciated.

7.      Transmission

   The MIME type for a Sieve script is "application/sieve".

8.      Acknowledgments

   I am very thankful to Chris Newman for his support and his ABNF
   syntax checker, to John Myers and Steve Hole for outlining the
   requirements for the original drafts, to Larry Greenfield for nagging
   me about the grammar and finally fixing it, and to Rob Earhart for an
   early implementation and a great deal of help.  I am also indebted to
   all of the readers of the [email-masked] mailing list.

9.      Parsing

9.1.     Lexical Tokens

   Sieve scripts are encoded in UTF-8.  The following assumes a valid
   UTF-8 encoding; special characters in Sieve scripts are all ASCII.

   The following are tokens in Sieve:

Showalter                 Expire in Six Months                 [Page 29]

Internet DRAFT                   Sieve                 February 11, 1999

           - identifiers
           - tags
           - numbers
           - quoted strings
           - multi-line strings
           - other separators

   Blanks, horizonal tabs, newlines, formfeeds, and comments ("white
   space") are ignored except as they separate tokens.  Some white space
   is required to separate otherwise adjacent tokens and in specific
   places in the multi-line strings.

   The other separators are single individual characters, and are
   mentioned explicitly in the grammar.

   The lexical structure of sieve is defined in the following BNF (as
   described in [ABNF]):

   CHAR-NOT-DOT = (%x01-2d / %x2f-%xff)

   CHAR-NOT-CRLF = (%x01-09 / %x0b-%x0c / %x0e-%xff)

   comment = "#" *CHAR-NOT-CRLF CRLF

   identifier = (ALPHA / "_") *(ALPHA DIGIT "_")

   tag = ":" identifier

   number = 1*DIGIT [QUANTIFIER]

   QUANTIFIER = "K" / "M" / "G"

   quoted-string = DQUOTE *CHAR DQUOTE         ;; in general,  CHAR
   inside a string maps to CHAR         ;; so         ;; note that
   newlines and other characters are all allowed strings

   multi-line = "text:" *(SP / HTAB) (comment / CRLF)
           *((1*CHAR-NOT-DOT *CHAR CRLF) / ("." 1*CHAR-NOT-DOT *CHAR
   CRLF) /           (".." *CHAR CRLF) / CRLF)         "." CRLF
           ;; note when used,         ;; a leading ".." on a line is
   mapped to ".".

   white-space = 1*(SP / CRLF / HTAB) / comment

9.2.     Grammar

   The following is the grammar of Sieve after it has been lexical

Showalter                 Expire in Six Months                 [Page 30]

Internet DRAFT                   Sieve                 February 11, 1999

   interpreted.  No white space or comments appear below.  The start
   symbol is "start".

   argument = string-list / number / tag

   arguments = *argument [test / test-list]

   block = "{" commands "}"

   command = identifier arguments ( ";" / block )

   commands = *command

   start = commands

   string = quoted-string / multi-line

   string-list = "[" string *("," string) "]" / string         ;; if
   there is only a single string, the brackets are optional

   test = identifier arguments

   test-list = "(" test *("," test) ")"

10.     Security Considerations

   Users must get their mail.  It is imperative that whatever method
   implementations use to store the user-defined filtering scripts be
   secure.

   It is equally important that implementations sanity-check the user's
   scripts, and not allow users to create on-demand mailbombs.  For
   instance, an implementation that allows a user to reject or redirect
   multiple times to a single message might also allow a user to create
   a mailbomb triggered by mail from a specific user.

   Therefore, an implementation SHOULD only allow one "reject" per
   message processed, and MAY limit the number of redirect actions
   taken.  An implementation MUST refuse to redirect a message to
   itself.  [OPEN: What do you do when a site limit prevents you from
   this?  Say I do three replies; which ones take effect when the limit
   is 1? 2? 0?]

   Several commands, such as "discard", "redirect", and "fileinto" allow
   for actions to be taken that are potentially very dangerous.

   In order to prevent mail loops, an implementation MUST refuse to
   filter a message that it has already filtered once; that is, a

Showalter                 Expire in Six Months                 [Page 31]

Internet DRAFT                   Sieve                 February 11, 1999

   message must not pass through a given server twice.

11.     Author's Address

   Tim Showalter
   Carnegie Mellon University
   5000 Forbes Avenue
   Pittsburgh, PA 15213

   E-Mail: [email-masked]

Appendix A.  References

   [ABNF] Crocker,  D.,  and  P.  Overell,  "Augmented  BNF  for  Syntax
   Specifications:   ABNF", Internet Mail Consortium, RFC 2234, November
   1997.

   [DSN] Moore, K., and G. Vaudreuil, "An Extensible Message Format  for
   Delivery Status Notifications", RFC 1894, January 1996.

   [FLAMES] Borenstein, N, and C. Thyberg,  "Power,  Ease  of  Use,  and
   Cooperative  Work  in a Practical Multimedia Message System", Int. J.
   of Man-Machine Studies, April, 1991.  Reprinted in Computer-Supported
   Cooperative  Work  and  Groupware,  Saul  Greenberg, editor, Harcourt
   Brace Jovanovich, 1991.   Reprinted  in  Readings  in  Groupware  and
   Computer-Supported  Cooperative  Work, Ronald Baecker, editor, Morgan
   Kaufmann, 1993.

   [KEYWORDS] Bradner, S., "Key  words  for  use  in  RFCs  to  Indicate
   Requirement Levels", RFC 2119, Harvard University, March 1997.

   [IMAP] Crispin, M.,  "Internet  Message  Access  Protocol  -  version
   4rev1", RFC 2060, University of Washington, December 1996.

   [IMAIL] Crocker, D., "Standard for the Format of ARPA  Internet  Text
   Messages", STD 11, RFC 822, University of Delaware, August 1982.

   [MIME] Freed, N., and  N.  Borenstein,  "Multipurpose  Internet  Mail
   Extensions  (MIME)  Part One: Format of Internet Message Bodies", RFC
   2045, Innosoft and First Virtual, November 1996.

   [SMTP] Postel, J., "Simple Mail Transfer Protocol", STD 10, RFC  821,
   USC/Information Sciences Institute, August 1982.

   [UTF-8] Yergeau, F. "UTF-8, a transformation format  of  Unicode  and
   ISO 10646", RFC 2044, Alis Technologies, October 1996.

Showalter                 Expire in Six Months                 [Page 32]

Internet DRAFT                   Sieve                 February 11, 1999

Appendix B.  Full Copyright Statement

   Copyright (C) The Internet Society 1999. All Rights Reserved.

   This document and translations of it may be copied and  furnished  to
   others,  and derivative works that comment on or otherwise explain it
   or assist in its implementation may be  prepared,  copied,  published
   and  distributed,  in  whole  or  in part, without restriction of any
   kind, provided that the above copyright notice and this paragraph are
   included  on  all  such  copies  and derivative works.  However, this
   document itself may not be modified in any way, such as  by  removing
   the  copyright  notice or references to the Internet Society or other
   Internet  organizations,  except  as  needed  for  the   purpose   of
   developing  Internet  standards  in  which  case  the  procedures for
   copyrights  defined  in  the  Internet  Standards  process  must   be
   followed,  or  as  required to translate it into languages other than
   English.

   The limited permissions granted above are perpetual and will  not  be
   revoked by the Internet Society or its successors or assigns.

Showalter                 Expire in Six Months                 [Page 33]


--Multipart_Thu_Feb_11_15:11:43_1999-1--

Date: 11 Feb 1999 13:43:05 -0500
From: Tim Showalter <[email-masked]>
To: [email-masked]
Subject: Re: Feedback on the document structure
Sender: [email-masked]

> Date: 11 Feb 1999 13:10:36 -0500
> From: Tim Showalter <[email-masked]>

> >     Incidentally, it is still not clear to me why we need the tagged
> >     argument support at all.  The stated contract for the optional
> >     argument should be enough.
>
> So this is probably just not clear.  First, all optional arguments are
> tagged arguments that can be left out (otherwise, it's hard to tell
> which arguments are which).  Otherwise, if a command has two optional
> arguments, and you want to leave one out, you can't tell which one was
> omitted.

Actually, there's an inconsistancy in the draft.  The MATCH-KEYWORD
argument is described both as being a tagged argument and an optional
argument; this is certainly my fault.

The MATCH-KEYWORD defaults to being ":is".

I have two questions:
	Should it be optional?
	Should it default to ":is"?

I don't care if it's optional, but if it is, should it default to
":contains" instead?

I've reworked the sections on arguments, put them all in one place,
better described positional arguments, and described optional arguments
as tagged arguments that can be left out.  The text from the nroff
source is this.

.xx "2.6. Arguments"
In order to specify how they function, most commands take arguments.  There
are three types of arguments: positional, tagged, and optional.

.xx "2.6.1. Positional Arguments"
Positional arguments are given to a command which discerns their meaning based 
on their order.  When a command takes positional arguments, all positional
arguments must be supplied, and must be in the order prescribed.

.xx "2.6.2. Tagged Arguments"
This document provides for tagged arguments in the style of CommonLISP.  These 
are also similar to flags given to commands in most command-line systems.

A tagged argument is an an argument for a command that begins with ":", and
consists of a tag naming the argument, such as ":contains".  This argument
means that zero or more of the next tokens have some particular meaning,
depending on the argument.  These next tokens may be numbers or strings, but
are never blocks.

So tagged arguments are similar to positional arguments, except that instead
of the meaning being derived from the command, it is derived from the tag.

Tagged arguments must appear before positional arguments, but they may appear
in any order.  For convienence, this is not expressed in the syntax
definitions with commands, but they still may be reordered arbitrarily
provided they appear before positional arguments.  Tagged arguments may be
mixed with optional arguments.

To keep the language simple, tagged arguments should not take tagged arguments 
as arguments.

.xx "2.6.3. Optional Arguments"
Optional arguments are exactly like tagged arguments except that they may be
left out, in which case a default value is used.  Because optional arguments
tend to result in shorter scripts, they have been used far more than tagged
arguments.

One particularly noteworthy case is the ":comparator" argument, which allows
the user to specify which ACAP comparator will be used to compare two strings,
since different languages may impose different orderings on UTF-8 [UTF-8]
characters.

Date: 11 Feb 1999 13:10:36 -0500
From: Tim Showalter <[email-masked]>
To: Steve Hole <[email-masked]>
Cc: [email-masked]
Subject: Re: Feedback on the document structure
Sender: [email-masked]

> From: Steve Hole <[email-masked]>
> Date: Wed, 3 Feb 1999 11:43:31 -0700

So by and large, I'm happy to take your comments on Sieve.  I'm working
on the document now, and trying to figure out exactly what you want, and 
in a couple cases I'm confused.

> I found that I wanted to use the term "tokens" to describe the language
> (from a true language parser's point of view :-).  You could substitute
> "objects" "sequences" "doodads" -- whatever -- for tokens. Anyway,
> something like:
> 
>    The language consists of a set of commands.   Each command consists
>    of a set of UTF-8 string tokens delimited by whitespace.   The first
>    token is the command string followed by 0 or more arguments.
>    Arguments can be either literal data, tests, or blocks of commands.

I think I took that paragraph.  There are probably other changes to be
made here to clean up stuff all over the document, but Larry's grammar
is the biggest one and is in my working copy.

> sec 2.2 - 2.9 Reordering
> 
> I would suggest the following reordering:

>  2.2. Evaluation
>  2.3. Commands
>  2.3.1.  Positional Arguments
>  2.3.2.  Optional Arguments
>  2.4. Whitespace
>  2.5. Comments
>  2.6. Literals

(Please excuse the editing of your message.)

I don't like this order better than the one in the document, but we can
probably improve on the one in the document.

My intent was to define things from the bottom up, not the top down.  I
see you want the exact opposite.

>  2.3.1.  Positional Arguments
>  2.3.2.  Optional Arguments
>     Move discussion on tagged arguments here.
> 
>     I think you need to mention that some commands will accept other
>     commands as arguments.   Specifically the control commands accept
>     test commands and action commands as arguments.

ok.

>     Incidentally, it is still not clear to me why we need the tagged
>     argument support at all.  The stated contract for the optional
>     argument should be enough.

So this is probably just not clear.  First, all optional arguments are
tagged arguments that can be left out (otherwise, it's hard to tell
which arguments are which).  Otherwise, if a command has two optional
arguments, and you want to leave one out, you can't tell which one was
omitted.

The further reason for tagged argument support is so that we can
introduce new modifiers to commands--if someone adds a new match keyword 
for header, I don't want to have to add it directly to the grammar.

I will move the discussion of arguments to one place and try and clean
it up.  Obviously it's gotten a little confused.

>     Beyond saying that this is "optional"
>     I'm not sure what information it conveys.  If optional arguments
>     always follow positional arguments, then even syntactically it
>     offers nothing useful.
>     
>  2.4. Whitespace
>  2.5. Comments
>  2.6. Literals

I can see the need for change, but I don't agree with this order.  I'll
try and nail down the tokenizer so that this stuff is a little more
ordered, 

> Changes to "Literal data"
> 
> First paragraph is a bit awkward -- specifically with the definition of
> execution.   I tend to think in terms of "evaluation" for interpretters.
> Now that we have a "token" concept introduced, perhaps something more like
> 
>    Literal data tokens are evaluated "as is" by a SIEVE interpretter and
>    consist of two types; numbers and strings.  Many commands accept
>    literal data arguments.
> 

I rewrote your literal data paragraph as follows:

| Literal data means data that is not executed, merely evaluated "as
| is", to be used as arguments to commands.  Literal data is limited to
| numbers and strings.

I hope that's ok.

> sec 2.6.  Tagged Arguments
> 
> The discussion on tagged arguments needs to be moved up or introduced
> sooner.  They imply a structure that needs to be more clearly stated as
> a "meta" structure for arguments.   In particular there is reference to
> "positional arguments" vs. "tagged arguments", but there is no
> definition for positional arguments.    I recommend that fold this into
> the general introduction to commands and arguments.

Ok.  I'll try to produce something more verbose for positional
arguments; I think I know what you want.

> sec 2.9.  Evaluation
> 
> This section needs to be expanded to include:
>  - evaluation ordering
>  - control issues
>  - command argument processing
>  - evaluation results ie.  what happens when you evaluate a control 
> command vs. a test command vs. an action.

I am not sure what you want.  Could you be more specific?  I thought all 
of this stuff was mostly obvious, I guess.

> Change the title "Control Structures" to "Control Commands"
> Change the title "Actions" to "Action Commands".
> Change the title "Tests" to "Test Commands"

ok.

From: Steve Hole <[email-masked]>
Date: Wed, 3 Feb 1999 11:48:13 -0700
To: Lawrence Greenfield <[email-masked]>
Subject: Re: Sieve grammar
Cc: [email-masked]
Sender: [email-masked]

On 3 Feb 1999 12:22:25 -0500 Lawrence Greenfield <[email-masked]> 
wrote:

> Here's yet another grammar for Sieve.  This seperates the lexical and
> grammatical parts of the language.  This fixes many (hopefully all) of
> the bugs with the grammar that have been noted on the mailing list
> previously but does not change the language at all.  (All previously
> legal scripts are still legal, and vice versa.)

This looks good!    I like the clear split between the lexical and 
grammatical content.   Note that the text at the beginning of the grammar 
is very useful information in what is now section 2.1 (see notes from my 
previous message).

Cheers.
---  
Steve Hole                           
Execmail Inc.
Mailto:[email-masked] 
Phone: 780-424-4922

From: Steve Hole <[email-masked]>
Date: Wed, 3 Feb 1999 11:43:31 -0700
To: Tim Showalter <[email-masked]>
Subject: Feedback on the document structure
Cc: [email-masked]
Sender: [email-masked]

Hi Tim.   I have some suggestions for changes to the text of the document 
that I think would make it clearer.     I have to admit to not having done
a cover to cover read for some time.    Sorry about that.

Anyway here are some suggestions.   I was trying hard to think about what 
someone being introduced to the language would see rather than read it 
with knowledge of the components in place.     I hope this is helpful Tim.

Cheers.
---

pg7 p3

   Implementations of the language are expected to take place at time of
   final delivery, when the message is moved to the user-accessible
   mailbox.  In systems where the MTA does final delivery, such as and
                                                                ^^^^^^
   traditional UNIX mail, it is reasonable to sort when the MTA deposits
   mail into the user's mailbox.

sec 2.1. Form of the Language

I found that I wanted to use the term "tokens" to describe the language
(from a true language parser's point of view :-).  You could substitute
"objects" "sequences" "doodads" -- whatever -- for tokens. Anyway,
something like:

   The language consists of a set of commands.   Each command consists
   of a set of UTF-8 string tokens delimited by whitespace.   The first
   token is the command string followed by 0 or more arguments.
   Arguments can be either literal data, tests, or blocks of commands.

   The language is represented in UTF-8, as specified in [UTF-8]

sec 2.2 - 2.9 Reordering

I would suggest the following reordering:

 2.2. Evaluation
 2.3. Commands
 2.3.1.  Positional Arguments
 2.3.2.  Optional Arguments
    Move discussion on tagged arguments here.

    I think you need to mention that some commands will accept other
    commands as arguments.   Specifically the control commands accept
    test commands and action commands as arguments.

    Incidentally, it is still not clear to me why we need the tagged
    argument support at all.  The stated contract for the optional
    argument should be enough.  Beyond saying that this is "optional"
    I'm not sure what information it conveys.  If optional arguments
    always follow positional arguments, then even syntactically it
    offers nothing useful.
    
 2.4. Whitespace
 2.5. Comments
 2.6. Literals

Changes to "Literal data"

First paragraph is a bit awkward -- specifically with the definition of
execution.   I tend to think in terms of "evaluation" for interpretters.
Now that we have a "token" concept introduced, perhaps something more like

   Literal data tokens are evaluated "as is" by a SIEVE interpretter and
   consist of two types; numbers and strings.  Many commands accept
   literal data arguments.

I'm not in love with this myself so feel free to hack it up.   In
general when discussing syntactic elements I would always use the term
evaluation (because that is what the interpretter does) and use
execution when discussing the result of evaluation.   Subtle difference
but important.

sec 2.6.  Tagged Arguments

The discussion on tagged arguments needs to be moved up or introduced
sooner.  They imply a structure that needs to be more clearly stated as
a "meta" structure for arguments.   In particular there is reference to
"positional arguments" vs. "tagged arguments", but there is no
definition for positional arguments.    I recommend that fold this into
the general introduction to commands and arguments.

sec 2.9.  Evaluation

This section needs to be expanded to include:
 - evaluation ordering
 - control issues
 - command argument processing
 - evaluation results ie.  what happens when you evaluate a control 
command vs. a test command vs. an action.

Note that this provides a nice seguay into the next topic (in the reodered
list) on commands.

sec 3. Control Structures

Change the title "Control Structures" to "Control Commands"

sec 4. Actions

Change the title "Actions" to "Action Commands".

sec 5. Tests

Change the title "Tests" to "Test Commands"

---  
Steve Hole                           
Execmail Inc.
Mailto:[email-masked] 
Phone: 780-424-4922

Date: 3 Feb 1999 12:22:25 -0500
From: Lawrence Greenfield <[email-masked]>
To: [email-masked]
Subject: Sieve grammar
Sender: [email-masked]

--Multipart_Wed_Feb__3_12:22:25_1999-1
Content-Type: text/plain; charset=US-ASCII

Here's yet another grammar for Sieve.  This seperates the lexical and
grammatical parts of the language.  This fixes many (hopefully all) of
the bugs with the grammar that have been noted on the mailing list
previously but does not change the language at all.  (All previously
legal scripts are still legal, and vice versa.)

--Multipart_Wed_Feb__3_12:22:25_1999-1
Content-Type: application/octet-stream
Content-Disposition: attachment; filename="grammar"
Content-Transfer-Encoding: 7bit

* Lexical Tokens

Sieve scripts are encoded in UTF-8.  The following assumes a valid
UTF-8 encoding; special characters in Sieve scripts are all ASCII.

The following are tokens in Sieve:
- identifiers
- tags
- numbers
- quoted strings
- multi-line strings
- other separators

Blanks, horizonal tabs, newlines, formfeeds, and comments ("white
space") are ignored except as they separate tokens.  Some white space
is required to separate otherwise adjacent tokens and in specific
places in the multi-line strings.

The other separators are single individual characters, and are
mentioned explicitly in the grammar.

The lexical structure of sieve is defined in the following BNF (as
described in [ABNF]):

CHAR-NOT-DOT = (%x01-2d / %x2f-%xff)

CHAR-NOT-CRLF = (%x01-09 / %x0b-%x0c / %x0e-%xff)

comment = "#" *CHAR-NOT-CRLF CRLF

identifier = (ALPHA / "_") *(ALPHA DIGIT "_")

tag = ":" identifier

number = 1*DIGIT [QUANTIFIER]

QUANTIFIER = "K" / "M" / "G"

quoted-string = DQUOTE *CHAR DQUOTE
	;; in general, \ CHAR inside a string maps to CHAR
	;; so \" maps to " and \\ maps to \
	;; note that newlines and other characters are all allowed strings

multi-line = "text:" *(SP / HTAB) (comment / CRLF)
	*((1*CHAR-NOT-DOT *CHAR CRLF) / ("." 1*CHAR-NOT-DOT *CHAR CRLF) /
	  (".." *CHAR CRLF) / CRLF)
	"." CRLF
	;; note when used,
	;; a leading ".." on a line is mapped to ".".

white-space = 1*(SP / CRLF / HTAB) / comment

* Grammar

The following is the grammar of Sieve after it has been lexical
interpreted.  No white space or comments appear below.  The start
symbol is "start".

argument = string-list / number / tag

arguments = *argument [test / test-list]

block = "{" commands "}"

command = identifier arguments ( ";" / block )

commands = *command

start = commands

string = quoted-string / multi-line

string-list = "[" string *("," string) "]" / string
	;; if there is only a single string, the brackets are optional

test = identifier arguments

test-list = "(" test *("," test) ")"

--Multipart_Wed_Feb__3_12:22:25_1999-1--

Date: Wed, 03 Feb 1999 12:14:27 -0500
From: Matthew Wall <[email-masked]>
To: [email-masked]
cc: Pete Resnick <[email-masked]>, Tim Showalter <[email-masked]>
Subject: Re: Language for conflicting actions
Originator-Info: login-id=wall; server=imap.cyrusoft.com
Sender: [email-masked]

--On Tue, Feb 2, 1999 5:25 PM -0600 the entity known as Pete Resnick
<[email-masked]> wrote:

> I see the possibility of a large system with a huge 
> number of active users coming back up on the net after some period of 
> downtime, the subsequent flood of mail, and then the subsequent flood 
> of filtering.
> 
> If we can get all of the needed functionality without requiring an 
> implementation to store arbitrary length data to do it, I think we 
> should go for the simpler method.

To which Matthew Wall offers this response on Wed, 03 Feb 1999 11:43:39
-0500:

I tend to agree with Pete here, to a point. 

- Always assume the worst case when planning for scalability. 

- that said, it's OK to put some parameters on the initial spec that might
be considered limiting if it's within the 98% of cases bound. This isn't
dictating an implementation so much as being realistic about a running
system's practical limitations.

With respect to the original issue, I think it's important for a _script_
to be able to do multiple fileintos or the equivalent. The question of
whether to complicate things with hair-splitting semantics for multiple
commands is just one of which is the most expeditious-to-implement-and-run,
and indeed, simpler is better -- as long as (imho) it allows multiple
fileintos _somehow_. Since there's going to be a certain amount of
queue-like actions in any implementation (if nothing else, to do a proper
multi-header boolean test before deciding whether to do a file or not), I
think it's reasonable to assume within a limited scope a script might be
executed this way, without this being a requirement to infinitely queue up
multiple actions with utterly no bounds.

Larry's summary seems reasonable to me:

> 
> Actions that do not affect delivery status can be used multiple times
> and in any combination with each other.  In the base draft, this
> actions are "fileinto" and "redirect".  Site policy may limit the
> number of particular actions taken.
> 
> Only one action that affects delivery status may be taken.  An attempt
> to run more than one such action leads to a run-time error, which has
> undefined behavior.  In the base draft, these actions are "keep",
> "discard", and "reject".

 - matt

Date: 2 Feb 1999 20:29:24 -0500
From: Lawrence Greenfield <[email-masked]>
To: [email-masked]
Subject: Re: Multiple actions in Sieve script.
Sender: [email-masked]

   Date: Fri, 29 Jan 1999 13:48:54 -0500
   From: Tony Hansen <[email-masked]>

   I personally think that adding this distinction NOW will vastly simplify
   future additions to the language. I can think of several possible
   extensions which definitely should not affect the delivery decisions
   that are made elsewhere within the script. By saying that these new
   actions must affect the delivery status without having a way of saying
   that they don't, or having a model for such actions in the future, we
   are going to make life more difficult in the future.

I agree with the distinction between actions that affect delivery
status and actions that do not.

I think part of the distinction should be:

Actions that do not affect delivery status can be used multiple times
and in any combination with each other.  In the base draft, this
actions are "fileinto" and "redirect".  Site policy may limit the
number of particular actions taken.

Only one action that affects delivery status may be taken.  An attempt
to run more than one such action leads to a run-time error, which has
undefined behavior.  In the base draft, these actions are "keep",
"discard", and "reject".

---

We can also nail down what happens when multiple delivery actions are
taken.  First?  Last?  I dunno.

This allows a script to execute the actions that don't affect delivery
status immediately without queuing them up, but should allow
implementations that wish to detect conflicting actions.  Future
extensions would have to be careful to maintain this balance.

Once concern that this raises is that I was intending to outlaw doing
a "reject" and a "fileinto", since this gives the sender the false
impression that a copy of the message was not kept.  Should we be
concerned about this?

Larry

Date: Tue, 2 Feb 1999 17:25:21 -0600
To: Tim Showalter <[email-masked]>
From: Pete Resnick <[email-masked]>
Subject: Re: Language for conflicting actions
Cc: [email-masked]
Sender: [email-masked]

On 1/28/99 at 6:00 PM -0500, Tim Showalter wrote:

> This isn't very good.  The best that you can do is do whatever happens
> first, and I don't consider that to be desirable.

I don't see a particular problem with that sort of logic flow. It 
could be done other ways, but what's the problem with "do the first 
one"? It certainly has an implementation simplicity advantage.

> I don't buy that at all.  I cannot imagine how a list of actions (which
> will typically be one per message and seldom more than five per message)
> could cause massive scaling problems even on the largest of central
> servers.

Statements like the above send up a red flag for me; anyone's 
inability to imagine a particular scaling problem doesn't strengthen 
my confidence. I see the possibility of a large system with a huge 
number of active users coming back up on the net after some period of 
downtime, the subsequent flood of mail, and then the subsequent flood 
of filtering.

If we can get all of the needed functionality without requiring an 
implementation to store arbitrary length data to do it, I think we 
should go for the simpler method.

pr
--
Pete Resnick <mailto:[email-masked]>
Eudora Engineering - QUALCOMM Incorporated
Ph: (217)337-6377 or (619)651-4478, Fax: (619)651-1102

Date: 2 Feb 1999 11:55:59 -0500
From: Tim Showalter <[email-masked]>
To: Tony Hansen <[email-masked]>
Cc: [email-masked]
Subject: Re: Support for the vacation extension
Sender: [email-masked]

> Date: Tue, 26 Jan 1999 09:48:53 -0500
> From: Tony Hansen <[email-masked]>
> Organization: AT&T Laboratories
> CC: [email-masked]
> 
> Tim Showalter wrote:
> > 
> > > How should +mailboxes to be handled?
> > 
> > You mean which mailbox to write to?  Vacation is a command that does not
> > modify the delivery status, so presumably, there's an implicit keep...
> 
> I don't think is says that very clearly. This is why we need to
> differentiate in the sieve draft that there are delivery actions and
> non-delivery actions. The vacation extension document can then simply
> say that it is a non-delivery action.

Sure.  The current draft is pretty out of date.  I'll try to come up
with better text for the next draft.

Tim

Date: Tue, 26 Jan 1999 09:48:53 -0500
From: Tony Hansen <[email-masked]>
Organization: AT&T Laboratories
To: Tim Showalter <[email-masked]>
CC: [email-masked]
Subject: Re: Support for the vacation extension
Sender: [email-masked]

Tim Showalter wrote:
> 
> > How should +mailboxes to be handled?
> 
> You mean which mailbox to write to?  Vacation is a command that does not
> modify the delivery status, so presumably, there's an implicit keep...

I don't think is says that very clearly. This is why we need to
differentiate in the sieve draft that there are delivery actions and
non-delivery actions. The vacation extension document can then simply
say that it is a non-delivery action.

	Tony Hansen
	[email-masked]