LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices



Reply
 
Search this Thread
Old 09-05-2003, 11:49 AM   #1
locoiguana
LQ Newbie
 
Registered: Sep 2003
Posts: 4

Rep: Reputation: 0
Email all users?


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!

Last edited by locoiguana; 09-05-2003 at 04:10 PM.
 
Old 09-06-2003, 02:57 AM   #2
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 991

Rep: Reputation: 30
one way is to add evvery user into a group and send mail to that group, it will be automatically delivered to all users
 
Old 09-06-2003, 02:58 AM   #3
jayakrishnan
Member
 
Registered: Feb 2002
Location: India
Distribution: Slacky 12.1, XP
Posts: 991

Rep: Reputation: 30
refer to some sendmail documentaion for how to add the users to the group
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Email Users neozero62 Linux - Newbie 2 11-30-2004 05:00 PM
email w/o system users suhewabe Linux - Software 3 07-13-2004 05:21 PM
Redhat 9 users , need help with email server ! Drogo Linux - Software 4 11-15-2003 08:06 AM
How to restrict email from users... Supp0rtLinux Linux - Software 1 01-08-2003 04:37 AM
quota for email of users monin Linux - Newbie 4 05-18-2002 03:22 AM


All times are GMT -5. The time now is 04:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration