From:	HENRY::IN%"McGuire_Ed%grinnell.mailnet%mit-multics.arpa%kl.sri.COM%relay.cs.net@rca.com"  9-APR-1987 16:21
To:	INFO-VAX@SRI-KL.ARPA
Subj:	Re: Where is the number of new mail mess

> Date:     Fri, 3 Apr 87 18:36:41 EST
> From:     Chettri@UDEL.EDU
> To:       info-vax@sri-kl.arpa
> Subject:  Where is the number of new mail messages stored
>
> When a user logs on (and he has new mail) then the system beeps him
> with a message "TWO NEW MAIL MESSAGES" (or the equivalent thereof).
>
> What I want to know is where this number is stored.  [. . .]
>
> Samir Chettri (chettri@udel-dewey.edu)

Cooincidentally, I _just_ finished figuring out that very thing, because I
needed to clear the new mail count for all users pursuant to converting to
a different mail system.

I determined experimentally the layout of the VMSMAIL file.  Here it is.
Bear in mind that I wasn't trying to make an exhaustive study, and I don't
know everything about the file layout.

0-30      Username (indexed file key)
31-32     Flags (auto purge, copy self on send, copy self on reply)
33-34     New mail count
35-54     Unused?
55        Length of SET MAIL_DIRECTORY subdirectory specification
56        Length of SET PERSONAL_NAME name
57        Length of SET FORWARD address
58-?      Variable length area.  Personal name first, then subdirectory,
          then forward address.

Here's a DATATRIEVE domain and record definition for the file.

REDEFINE DOMAIN MAIL USING MAIL_REC ON SYS$SYSTEM:VMSMAIL.DAT;

REDEFINE RECORD MAIL_REC USING
01 MAIL_REC.
   02 BYTES.
      03 OCTET OCCURS 16 TIMES.
         04 BYTE0 USAGE IS BYTE.
         04 BYTE1 USAGE IS BYTE.
         04 BYTE2 USAGE IS BYTE.
         04 BYTE3 USAGE IS BYTE.
         04 BYTE4 USAGE IS BYTE.
         04 BYTE5 USAGE IS BYTE.
         04 BYTE6 USAGE IS BYTE.
         04 BYTE7 USAGE IS BYTE.
   02 RAW REDEFINES BYTES.
      03 USERNAME PIC X(31).
      03 FLAGS USAGE IS WORD.
      03 NEW_MAIL_COUNT USAGE IS WORD.
      03 NULLS PIC X(30).
      03 D_LEN USAGE IS BYTE.
      03 PN_LEN USAGE IS BYTE.
      03 F_LEN USAGE IS BYTE.
      03 VLA PIC X(60).
   02 FIELDS.
      03 USERNAME COMPUTED BY RAW.USERNAME EDIT_STRING T(12).
      03 FLAGS COMPUTED BY RAW.FLAGS.
      03 NEW_MAIL_COUNT COMPUTED BY RAW.NEW_MAIL_COUNT.
      03 PNAME COMPUTED BY FN$STR_EXTRACT (VLA, 1, PN_LEN) EDIT_STRING
           T(30).
      03 DIRECTORY COMPUTED BY FN$STR_EXTRACT (VLA, 1 + PN_LEN, D_LEN)
           EDIT_STRING T(15).
      03 FORWARD COMPUTED BY FN$STR_EXTRACT (VLA, 1 + PN_LEN + D_LEN,
           F_LEN) EDIT_STRING T(24).
;

Ed McGuire
Grinnell College
MCGUIRE@GRIN2.BITNET
cc:  INFO-VAX@SRI-KL.ARPA
