From: CSBVAX::CSBVAX::MRGATE::"SMTP::CRVAX.SRI.COM::RELAY-INFO-VAX" 24-JAN-1989 11:53 To: MRGATE::"ARISIA::EVERHART" Subj: re: archiving VMS mail Received: From KL.SRI.COM by CRVAX.SRI.COM with TCP; Tue, 24 JAN 89 07:54:28 PDT Received: from Venus.YCC.Yale.Edu by KL.SRI.COM with TCP; Tue, 24 Jan 89 07:43:24 PST Date: Tue, 24 Jan 89 10:46 EST From: "Jerry Leichter (LEICHTER-JERRY@CS.YALE.EDU)" Subject: re: archiving VMS mail To: SCHAEFFER@amstel.llnl.GOV, INFO-VAX@KL.SRI.COM X-VMS-To: IN%"SCHAEFFER@amstel.llnl.GOV",INFOVAX I am in need of a mechanism for archiving VMS mail for 5-year legal records. We have a particular account that is the recipient for such mail and after it has been read we must archive it at an interval that is convenient to us, probably weekly or monthly. The volume of mail messages will likely reach the 100s/day in the near future so it is obvious that we do not want to do this manually! I could write a DCL procedure to extract each message to a text file and then delete it from mail. The text files need to have something that indicates the time the mail was received in the file name. We can't go to VMS version 5 because of some 3rd party software that doesn't work with V5 so callable mail is not an option just yet. Once the mail is in text files a simple backup will take care of the archiving. Two independent ideas: 1. Take a look at DELIVER, a program that comes with the PMDF mail package. It allows you (among other things) to set up a batch job which will be triggered by the arrival of any mail for an account. The job can do whatever it wants with the mail. This is a nice general scheme, but I suspect it would require a large, com- pletely dedicated system to deal with hundreds of messages a day! 2. You can do surprising things with MAIL as it stands. First of all, any mail whose text is more than about 512 bytes long (I forget the exact number) is stored in one of those MAIL$ files you see in your mail subdirectory. The is simply the hex representation of the VMS standard date-time string that the mail was received. So in a way you already have what you are looking for. Second, even in V4, SELECT and MOVE are more powerful than people usually realize. For example, SELECT MAIL/BEFORE:today-31- selects all mail more than 31 days old. Once the selection is made, you can do: MOVE/ALL MAIL ARCHIVE moves all the selected mail to folder MAIL in file ARCHIVE. This allows you to create "time slices" out of your mail, which you can then save with BACKUP and delete. (If your slices always are for all messages in some interval, and you don't do anything bizarre with your mail files, using the dates of crea- tion of the MAIL$xxx.MAI files for selection in BACKUP will let you pick out the files that really belong to the time slice.) BTW, this touches on an issue recently discussed here: If you are really receiving hundreds of messages a day, and deleting (archiving) the old ones on a regular basis, your the directory file for your mail subdirectory will soon become huge and badly organized. Access will be very slow. The way to fix this is to create a temporary directory, rename all the files in your mail subdirectory into the new one, delete the mail subdirectory, and rename the temporary directory to the name of the old mail directory. This is best done at a time when you are certain no new mail will arrive, since there is a short period during which your mail directory isn't set up right. I've attached an extract from a command file I run every week. -- Jerry $! $! Re-create the mail subdirectory ([.MAIL]). This is done in an order $! which minimizes the time in which an invalid mail configuration exists. $! Nevertheless, things CAN go wrong (if the system crashes at just the wrong $! time, for example). $! $! This code will not work as written on VMS V5 - it would need to set the $! files in [.MAIL] to have O:REWD or VMS V5 won't allow it to rename them. $! At the end, it should probably change the protections back. $! $ create/dir/prot=(S:RWE,O:RWE,G,W) [.WEEKLY_TEMP] $ rename/nolog [.MAIL]*.*;*/exclude=mail.mai;* [.WEEKLY_TEMP] $ rename MAIL.dir WEEKLY_TEMP1.dir $ rename WEEKLY_TEMP.dir MAIL.dir $ rename [.WEEKLY_TEMP1]*.*;* [.MAIL] ! Move the MAIL.MAIL file $ set file/prot=O:REWD WEEKLY_TEMP1.dir $ delete WEEKLY_TEMP1.dir;