Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!msunews!agate!howland.reston.ans.net!swrinde!newsfeed.internetmci.com!in2.uu.net!news.jersey.net!zeus.jersey.net!bherd From: bherd@zeus.jersey.net (Bil Herd) Newsgroups: comp.unix.bsd.freebsd.misc Subject: Re: mail-all util? Date: 18 Nov 1995 07:36:10 GMT Organization: InterActive Network - Serving SNJ - SLIP/PPP/SHELL Lines: 29 Message-ID: <48k2da$9d@hermes.jersey.net> References: <4886vd$ah@voyager.flash.net> <489j9f$qk@uriah.heep.sax.de> NNTP-Posting-Host: zeus.jersey.net X-Newsreader: TIN [version 1.2 PL2] J Wunsch (j@uriah.heep.sax.de) wrote: : Mike Wilson <mwilson@flash.net> wrote: : >As the title suggest I am looking for a utility that will allow me to : 'mailall' or at least mailgroup. Crude script extracts all users of group $USERGID and send them mail. Was too much in a hurry to do the subject line. This is for reference, I make no warrenty on the functionality etc. I use this instead of alias as I want to add a "dont send to" specific file and other things later. Bil Herd ---- cut here #!/usr/bin/perl # Mail to all users. If a filename is not specified it is promted for. require '/etc/adm/lib/adm.pl'; $USERGID = "100"; if ($#ARGV < 0) {$ARGV[0]=&query("Enter filename to mail to all user","")}; $filename = $ARGV[0]; while (($username, $passwd, $uid, $gid)=getpwent){ if ($gid == $USERGID) { print "Mailing\-$subject $username < $filename \n"; system ("mail $username < $filename"); } }