procmail
[Top] [All Lists]

Re: Custom mail directories

1996-09-23 12:46:45
GARY <paranet(_at_)nexus(_dot_)flash(_dot_)net> writes:
Can anyone suggest an easy method using procmail to deliver mail to 
subdirectories of /var/mail based on the first two characters of $LOGNAME.  For
example:

      username ($LOGNAME)     = abc
      $MAILDIR                = /var/mail/a/b

Actually, you really want to set $ORGMAIL to /var/mail/a/b/abc, and
leave $MAILDIR alone.


...
Since this setup will be used by an ISP with a very heavy e-mail load, I am 
looking for the most reliable and efficient method of doing this.

Code it in C in procmail.c, making the initial assignment to ORGMAIL
magical.  Calling ksh three times for every message is not going to be
efficient in any sense of the word.

The other option I see would be to make LOGNAME a magic variable on
assignment, such that assigning to LOGNAME would result in the setting
of two other variables LOGNAME_F and LOGNAME_S (or whatever) so that
they contain, respectively, the first two characters of the new $LOGNAME.
Combine that with setting $SYSTEM_MBOX to

        /var/mail/$LOGNAME_F/$LOGNAME_S/$LOGNAME

and <poof>, it works.  However setting up that magic isn't quite trivial.
The magic should take place in asenv(), but that isn't called currently
on the initial assignment, so you'll have to hack that in procmail.c,
along with the changes to asenv() in misc.c

Philip Guenther

<Prev in Thread] Current Thread [Next in Thread>