From:	MERC::"uunet!WKUVX1.BITNET!MacroMan" 23-JUL-1992 08:44:25.40
To:	MACRO32@WKUVX1.BITNET
CC:	
Subj:	Here is the VAX/VMS mail file format

>I need to know if there is a way, on a Unix machine, to read/convert a
>mail.mai file which was ftp'd from a VAX machine.
[...]
>With that in mind, what do you recommend? I see converting the file on
>the receiving Unix machine as the best option, but I'll need either a
>converter program/script, or information about the .mai file format so
>I can write one myself. Any help will be greatly appreciated!!
>
I had to figure it all out by hand several years ago (with VMS
v4.6---before callable mail arrived).  When I finally had access to
the source listings, I corrected my format description. It follows
below.  I'm 99% sure that it's still accurate for VMS v5.5. Note: this
is the format of the MAIL.MAI file, not the VMSMAIL_PROFILE.DATA file.

All information comes from MAILDEF.SDL in VMS V5.0 micro-fiche

Mail message header record

Quadword:
        DATIM           Date/time message received

(Date/times with high quadword 0 are reserved as info records)
        1       LASTREAD        Date/time of last read message
        2       WASTENAME       Name of wastebasket folder
        3       FILEINFO        File status information
        4       MW              Mailwatch info record
        5       NEWMSG          New message information
Byte:
        FILKEYLEN       Length of the filing key
39 bytes:
        FILEKEY         Filing key

Word:
        Flags:
        NEWMSG          This is a new message
        REPLIED         This message has been replied to
        SKIP1           Skip a bit
        EXTMSG          Message text in external file
        EXTFNF          External file not found
        SYSMSG          Message text in system file
        EXTNSTD         External foreign type message
        MARKED          This message has been marked
        SKIP2           Skip recmode flag
Byte
        FLAGSIZ         Size of flag string if ASCII
Longword
        FLAGVAL         Value of /FLAG=
Byte
        HDSPARE         Spare byte to align DATID
Quadword
        DATID           Key ID of data record

        MISCDAT         Start of variable data

Format:  type.w,size.w,data.w

0       From
1       To
2       Subject
3       CC
4       Mailwatch info
5       Number of records in message
6       Message is in external file; this is spec
7       Security class

Hunter
------
Hunter Goatley, VMS Systems Programmer, Western Kentucky University
goathunter@WKUVX1.BITNET, 502-745-5251
