#!/usr/local/bin/perl # sends mail to all darpc people, who should be given on stdin ## in fact this is a general purpose mail-personaliser # # see also mailer.p which is an improvement # $verbose = 1 ; $file = "null-file" ; $subject = "Darwin Physical and Chemical Sciences Invitation" ; # $doit = 0 ; # whether to send email $letter = 0 ; # whether to print out a letter too $address = "Darwin College" ; $topgap = 10 ; $bottomgap= 31 ; $font = "Courier16" ; # usage: in ~/pubwww/darpc # darpc.p subject="Darwin Group" file=tmp doit=1 < fellows # darpc.p subject="Darwin Group" file=tmp doit=1 < students # darpc.p subject="Darwin Group" file=tmp doit=1 < associates # darpc.p file=tmpf doit=0 < fellows # darpc.p file=tmp doit=0 letter=1 < students # darpc.p file=tmp doit=1 letter=1 < students # darpc.p file=tmp doit=1 letter=0 < students # darpc.p file=tmpa doit=1 letter=0 < associates # stdin should have the following format: (email, first name, other names) # example: ## Metallurgy < comments are permitted # hkdb@cus Harry Bhadeshia ## Institute of Astronomy # acf@mail.ast Andy Fabian # mmc11@cam Munawar M. Chaudhri # mds21@phy Matthew Segall # mackay@mrao David J.C. MacKay eval "\$$1=\$2" while @ARGV && $ARGV[0]=~ /^(\w+)=(.*)/ && shift; while ( <> ) { if (/\#|\2) ; if ($doit) { system $command ; } # if ($letter ) { # first page, cover $lfile = "\n"x$topgap . " "x10 . $name ."\n" . " "x10 . $address . "\n"x$bottomgap ; $lfile .= $greeting."\n" ; $tmpfile = "junktmp" ; open ( OUT , "> $tmpfile" ) ; print OUT $lfile ; close(OUT) ; system ( "cat $file >> $tmpfile" ) ; system ( "nenscript -p- -B -f $font $tmpfile | lpr -Pisduplex " ) ; } } } }