Suggestions on One-Time Mailing
Ow Mun Heng
ow.mun.heng at wdc.com
Fri Dec 19 01:25:44 UTC 2003
> -----Original Message-----
> From: David C. Hart [mailto:dch at TQMcube.com]
> Sent: Friday, December 19, 2003 3:01 AM
> To: Fedora-List
> Subject: Suggestions on One-Time Mailing
>
>
> I know that this is a bit OT but this group has some very experienced
> *nix users.
>
> I have to do a one-time mailing for a client (NOT spam). I have a text
> file of 400 email addresses. Any suggestions on a simple way
> to do this?
In Case you didn't solve it already.. Here's a simple shell script
I use to get my users to change passwords
#!/bin/tcsh
#
# mail-all: This mails the users specified in a filename
#
# USAGE : mail-all /path/to/username/file "Message Filename"
# Writen and Adapted from abs-guide.pdf by Ow Mun Heng
# check for a subject
#
if ($1 == "") then
echo
echo You did not supply a Username file
echo Correct usage is :-
echo $0 usernamefile.txt "filename"
echo
echo
exit 1
else
# Get the name of the username file
set usernamefile=$1
endif
if (`echo $2 | awk '{ print $1 }'` == "") then
echo
echo You did not supply a Message File Name
echo Correct usage is :-
echo $0 usernamefile.txt "Message File"
echo
exit 2
else
set messagefile="$2"
endif
#
# Check that the file exists
#
if (-f $usernamefile && -f $messagefile) then
echo Sending the mail to the specified users
else
echo File does not exist
exit 3
endif
#
# Loop through every login name but skip the 1st 38 accounts
#
#foreach user (`awk -F: '{ print $1 }' /etc/passwd | tail +36`)
foreach user (`awk -F: '{ print $1 }' $usernamefile | tail +38` )
#foreach user (`awk -F: '{ print $1 }' $usernamefile`)
#Mail the file
echo
echo Sending mail to $user
echo mail -s '"Pls Change Password"' $user < $messagefile
mail -s "Pls Change Password" $user < $messagefile
echo
# Sleep for a few seconds so we don't overload the mailer
sleep 2
end
#
# echo ALL Done....
More information about the fedora-list
mailing list