Hi, I'm still very new to Linux Server administration (I really only started doing it about a month ago), but I am responsible for administering a RedHat 8 Mail Server at my company.
The Server supports about 200 email accounts across roughly 80 domains, and the problem is, I just installed SpamAssassin, and now I need to notify my users about the change.
This may be a silly question, but for the life of me I can't figure out how to email every user on the system without manually typing each individual email address into a message.
I could probably set up a list server like majordomo to handle all users as a mailing list, but I have to believe that there is an easy way to do this that I'm just not aware of.
Any suggestions that anyone can offer would be GREATLY appreciated.
Thanks!
UPDATE: Shortly after I posted this thread I found the following script:
-Start Script-
#!/bin/csh
#
# mailfile: this script mails the specified file to all users
# of the system. It skips the first 17 accounts so
# we do not send the email to system accounts like
# 'root'.
#
# USAGE: mailfile "Subject goes here" filename.txt
#
# Check for a subject
#
if ( `echo $1 | awk '{ print $1 }'` == "" ) then
echo You did not supply a subject for the message.
echo Be sure to enclose it in quotes.
exit 1
else
# Get the subject of the message
set subject=$1
endif
#
# Check for a filename
#
if ( $2 == "" ) then
echo You did not supply a file name.
exit 2
else
# Get the name of the file to send
set filename=$2
endif
#
# Check that the file exists
#
if ( -f $filename ) then
echo Sending file $filename
else
echo File does not exist.
exit 3
endif
#
# Loop through every login name, but skip the first 17 accounts
#
foreach user ( `awk -F: '{ print $1 }' /etc/passwd | tail +17` )
# Mail the file
echo Mailing to $user
mail -s "$subject" $user < $filename
# sleep for a few seconds so we don't overload the mailer
# on fast systems or systems with few accounts, you can
# probably take this delay out.
sleep 2
end
-End Script-
I had hoped that this would solve my problem, but it only helped me uncover a new one: for some reason or another my Mail utility does not actually send mail!
I've read the help and man pages, and a (very helpful) document from O'Riely, but nothing seems to help. I've tried sending a test message using this utility in every possible way I could think of, and always with the same result - it acts like it sends, but no mail ever arrives.
As a band-aid to my situation, I managed to compile a list of all email addresses on my system (via the comment line on each user account (which I have been entering the full email account into)). I then took this list and sent it out using a GUI mail program on another system.
This solves my problem this time, but doesn't do much for me next time this situation comes up.
So once again, anyone who can point me in the right direction as to why my mail utility doesn't work, or give me another option, please help!