Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do you send mail to all users on system?

Status
Not open for further replies.

bkonner

MIS
Apr 28, 2001
101
US
Howdy,

How can I send an email to all users on my email system (as root)? I am using Sendmail with RedHat 7.0.

Thanks
 
#!/bin/sh
#mail_everyone
all_names=$(cat /etc/passwd | awk ' BEGIN { FS = ":" }
{
print $1
}')

for ii in `echo $all_names`
do
echo "My message" | mail $ii
done
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top