Path: utzoo!yunexus!geac!syntron!jtsv16!uunet!seismo!sundc!pitstop!sun!amdcad!ames!pasteur!ucbvax!hplabs!hplabsz!mayer From: mayer@hplabsz.HPL.HP.COM (Niels Mayer) Newsgroups: comp.mail.mh Subject: Re: can I identify folders with new mail Message-ID: <2488@hplabsz.HPL.HP.COM> Date: 26 Oct 88 02:06:12 GMT Article-I.D.: hplabsz.2488 References: <348@taeva.UUCP> Reply-To: mayer@hplabs.hp.com (Niels Mayer) Organization: Hewlett-Packard Labs, Software Technology Lab, Palo Alto, CA. Lines: 40 Summary: Expires: Sender: Followup-To: In article <348@taeva.UUCP> hans@taeva.UUCP (Hans von Kleist-Retzow) writes: > >We are building a mailfilter which allows to distribute the >incoming mail into different folder. Now I have the problem >that I want to get informed in which folder new mail has arrived. >So I need an extension to folders (e.g. an option 'new') which >shows only the folders which contain mails which I haven't seen up >to now. To get this date I must expand scan and show so that it marks a mail >if it is read. etc. There has to be done a little bit more. I'm assuming you'vo got "| /usr/local/lib/mh/slocal" in your ~/.forward file and are using 'rcvstore' program to incorporate messages into the chosen folders as specified by the file ~/.maildelivery used by 'slocal'. I'm also assuming that you've set "Unseen-Sequence: unseen" in your ~/.mh_profile. Given the above, new messages that are automatically incorporated by 'rcvstore' get added to the unseen sequence of the paricular folder. (Viewing a message with 'show' will remove it from the unseen sequence). You can then use various techniques to figure out the existance of the unseen sequence in the folders: 1) look for "unseen: ... " in /.mh_sequences; or 2) use mhpath. For example, I just whipped up the following using csh interactively: hplnpm[21] ~> foreach i (`folders -recurse -fast`) ? mhpath +$i unseen >& /dev/null ? if ($status == 0) echo Unseen messages in folder $i ? end The results I got were: Unseen messages in folder inbox Unseen messages in folder music/research Unseen messages in folder nm-list Unseen messages in folder subgenius Happy hacking, Niels Mayer.