Thanks for your reply. Frankly speaking, I'm new to sendmail & Linux, only 2 mths exp. Is there a easier way to it? May be with some sort of mail client?
if you know everyone on your system, then you could create a mailing list with everyones name in it (that was what the grep line above was for) then you could send messages to everyone.
--------------------------
grep 'sh$' /etc/passwd <-- this finds everyone in /etc/passwd that has a shell ending in 'sh', so csh, ksh, sh, bash, bsh ... etc. will be got. daemon, bin, sys, adm, lp etc will not be mailed.
awk '{split($0,a,":" print a[1];}' <-- get the first bit of the line before the ':' and output it.
mail is just the command line mail tool.
the best way to do this really is to have an up to date alias list in /etc/mail/aliases with a mailing list with all the users in it.
then when anyone emails the mailing list name it will get sent to all the users in the list.
it might be nicer to get away without sending mail to everyone if you can, putting messages in the message of the day (motd) if they log in, bulletin board systems for colleagues, or something similar.
sendmail doesn't automatically provide you with a way of mailing everyone, mainly because it doesn't know who "everyone" is.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.