procmail
[Top] [All Lists]

Re: Distributing mail for a group

1996-12-31 18:08:39
Chuck Kennedy asked,

| :0 c
| * ^TOmarco
| ! mpact(_at_)aa(_dot_)net
| 
| This works and, of course, sends the mail intact. The problem is that
| Matthew needs to read the message to find out [which of the non-netting
| people for whom he is accepting and printing out email] it's for.  ... 
| It would be nice if Matthew could know whose mail it is and print it off
| without reading the contents.

Any chance of Matthew's using procmail to identify mail that you forward
to him for him to print out for the whole group?  He could do it with ^TO
recipes just as you do and simply drop each group member's mail (other than
his own) into a folder for that member and print out the various folders.

| My thought is to forward the message with the subject changed to "Mail for
| Marco" and add an additional line to the body with the original subject.
| I'm not sure how I would do that.

If Matthew cannot use a mail thrower like procmail and must identify mail for
others by eye, first we need to find out what headers he can see easily.  I'd
hate on principle to supersede the subject line, but it may not be a bad
idea, since the end recipient reads hard copy and can see the original
subject at the top of the text.

So let's see where we stand.  You didn't name any of the people there except
Marco, so I'll have to make up some other names for this.  Let's say it's
a quartet, and Matthew is one of them, and the other two are named Felicia
and Lorraine.  This will key on the first mpact.com address found in the
headers, so if we want to handle mail addressed to more than one of them,
it gets far more complicated.

Also, there is a basic flaw in the setup: at this point the envelope infor-
mation is lost, so if something is blind carboned to an mpact.com address,
we can't find out the intended recipient in the visible headers.  That is
an additional problem.  But let's take the simpler case of working with
visible headers:

  :0
  * ^TO_\/[-a-z0-9_(_dot_)]+(_at_)mpact-com
  {
   ADDRESSEE=$MATCH

   :0
   * ADDRESSEE ?? ^^\/[^(_at_)]+
   { RECIPIENT=$MATCH }

   REALNAME # make sure it's unset to start

   :0 # fix the casing; put the person who gets the most mail first
   * RECIPIENT ?? ^^felicia^^
   { REALNAME=Felicia }
   :0E
   * RECIPIENT ?? ^^lorraine^^
   { REALNAME=Lorraine }
   :0E
   * RECIPIENT ?? ^^marco^^
   { REALNAME=Marco }

# If it's for anyone else -- including Matthew and all invalid names -- we'll
# send it to Matthew unchanged.  But if it's for a known group member, let's
# flag it.

   :0bfw # search head but operate on body
   * REALNAME ?? .
   * ^^\/Subject:.*
   | echo Original "$MATCH" ; echo "" ; cat -

# (A single sed command can take the place of those three and the shell they
# spawn, but it would break if the subject had a continuation line.)
# For backup, let's keep the original subject in an Old-Subject: header as
# well, as James Di Torio suggested:

   :0Ahfw # If we did that, also change subject for Matthew to notice:
   | formail -i "Subject: print this for $REALNAME"

# and then off to Matthew it goes:

   :0
   ! mpact(_at_)aa(_dot_)net
  }

If the end recipient can easily find the original subject line in the
Old-Subject: header of the printout, then we don't need to put it at the
top of the body, and we can condense the third-to-last and second-to-last
recipes to this (which means that James solved the core of the problem):

  :0hfw
  * REALNAME ?? .
  | formail -i "Subject: print this for $REALNAME"

There are some different approaches we could take as well, such as prepending
the recipient's name to the incoming subject; for that, we have to make sure
not to add it if it's already there, and we have to allow for misspellings.

The ideal way to do this is not to depend on visible headers but to have
proper aliases for each legitimate username in mpact.com.  I don't know how
you and your own ISP could arrange that, but ideally they'd pass the enve-
lope information to you (for example, with procmail's -a option).

<Prev in Thread] Current Thread [Next in Thread>
  • Re: Distributing mail for a group, David W. Tamkin <=