[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] send an email to all users?



> I remember that someone posted to the list a great way to create an email 
> address that would deliver to all users on a  RaQ server.  I can't find it in 
> my notes or in the archives.

if 'all users' includes root, bin, nobody, etc, as well as flesh-n-blood
users, this will do:

cut -d : -f 1 /etc/passwd |
while read USER; do mail -s "${SUBJECT}" ${USER} < ${MAIL_IN_TEXT_FILE}; done 

If you want to exclude certain accounts, put them in a file, one per line:

cut -d : -f 1 /etc/passwd | egrep -v -f ${FILE_LISTING_ACCOUNTS_TO_EXCLUDE} | 
while read USER; do mail -s "${SUBJECT}" ${USER} < ${MAIL_IN_TEXT_FILE}; done 

tim

--