I use a script to get a cunnect list of users in differnet groups into
a file and then use sendmail with /etc/aliases


<-cut- /etc/aliases>
# Put any sendmail aliases in here
# Rember to run `newaliases` after adding
postmaster:root,chris
admin:  chris

everyone:       users,staff,pusers
# list of group files
users:  :include:/home/chris/scripts/mailusers/users
staff:  :include:/home/chris/scripts/mailusers/staff
pusers: :include:/home/chris/scripts/mailusers/pusers
<-end cut->

when adding a file as a aliases make sure its chmod +r

the script only requires a few setting and then will make a file for
every group in the LISTGROUPS file

<-cut- /usr/local/sbin/usermail>
#!/bin/sh
# /usr/local/sbin/usermail      v1.2
# Reads the LISTGROUPS file and then makes a file named after each group
# listed using the /etc/groups and /etc/password file first field
# to creates a mailing list file from all the usernames.
# It only places a user in the first group ( groupid in /etc/password )
#
# best run by cron from time to time
# 17 1 * * * *  /usr/local/sbin/usermail 1>/dev/null 2>/dev/null
#
# [EMAIL PROTECTED]  http://chris.hislora.com.au

MYDOMAIN="hislora.com.au"
OUTPUTDIR=/home/chris/scripts/
LISTGROUPS=/home/chris/scripts/maillistgroups
TEMPFILE=/tmp/.newmail1

for g in `cat ${LISTGROUPS}|grep -v '#'`
 do
  THISGROUP=${g}
  THISGID=`cat /etc/group |grep ${THISGROUP}:| /bin/cut -d ":" -f "3"`
  GROUPLIST=`cat /etc/passwd |grep :${THISGID}:| /bin/cut -d ":" -f "1"`

  for u in ${GROUPLIST}
   do
   whatever="${u}@${MYDOMAIN}"
   echo ${whatever} >> ${TEMPFILE}
  done

  sort -fd ${TEMPFILE} | /usr/bin/uniq > ${OUTPUTDIR}/${THISGROUP}
  rm -frv ${TEMPFILE}
  chmod a+r ${OUTPUTDIR}/${THISGROUP}
 done
<-end cut->


the LISTGROUPS file should only have one group per line

<-cut- maillistgroups>
# add one group per line
users
staff
pusers
<-end cut->


I have a second script that dose this live but found that when its run
with 300 users and several mails at a time my old mailserver (386) got
real bogged down 

> I am setting up a network in our office. We are using a Linux 2.0.35 server
> and sendmail 8.8.* for handling internal/external mail. My question is, is
> there a way for an internal mail to be addressed to all users in the
> network? If so, how?
> 

                         |          / /    __  _  _  _  _ __  __
 chris                   |         / /__  / / / \// //_// \ \/ /
 ([EMAIL PROTECTED])  |        /____/ /_/ /_/\/ /___/  /_/\_\
                         |    ...because lockups are for convicts...

-
To unsubscribe from this list: send the line "unsubscribe linux-net" in
the body of a message to [EMAIL PROTECTED]

Reply via email to