Path: utzoo!attcan!uunet!ogicse!schaefer From: schaefer@ogicse.ogc.edu (Barton E. Schaefer) Newsgroups: comp.unix.questions Subject: Re: Programmatic Mail reader Message-ID: <10899@ogicse.ogc.edu> Date: 28 Jul 90 21:35:48 GMT References: <1990Jul26.155303.15563@mips2.cr.bull.com> Organization: Oregon Graduate Institute (formerly OGC), Beaverton, OR Lines: 37 In article <1990Jul26.155303.15563@mips2.cr.bull.com> peters@mips2.cr.bull.com (Dan Peters) writes: } } This is my first post to this newsgroup, I hope it is appropriate. } What is the easiest way to programmaticly do the following: } } read mail, } dump it to a file (i.e. log) } delete the messages read (so they arn't logged again), } quit mail I'm not sure what you mean by the first step ("read mail") -- does that mean you want to see each message before it gets saved? If you have mush 7.1 available, that would be: #!/usr/local/bin/mush -F! unset hold set alwaysignore = pipe pipe * /usr/bin/pg save * dlog quit You could also get a little fancier: #!/usr/local/bin/mush -F! unset hold if redirect # Don't display if stdin is not a tty :n | save dlog # save new mail only else set alwaysignore = pipe :n | /usr/bin/pg | save dlog # print & save new mail only endif quit Mush is available from the comp.sources.misc archives. -- Bart Schaefer schaefer@cse.ogi.edu