Mailing List
Home
Linux - General Red Hat Linux discussion list
Enterprise Linux 3 - Discussion of Red Hat Enterprise Linux 3 (Taroon)
Red Hat Linux 9 - Discussion of Red Hat Linux 9 (Shrike)
Installation - Getting started with Red Hat Linux
Red Hat Linux 7.3 - Discussion of Red Hat Linux 7.3 (Valhalla)
Red Hat Linux 8.0 - Discussion of Red Hat Linux 8.0 (Psyche)
Red Hat Linux 7.2 - Discussion of Red Hat Linux 7.2 (Enigma)
Red Hat Linux 7.1 - Discussion of Red Hat Linux 7.1 (Seawolf)
Apache Web Server
Oracle database, Microsoft SQL server ...
Subjects
application/x mplayer2 plugin
RPM error: db4 error(16) from dbenv >remove: Device or resource
   busy
Command stream end of file while reading
X Windows problem (xauth)
Upgrading openoffice 1 1 rpm
FTP: connection refused
FTP: connection refused
mount: /dev/cdrom: is not a valid block device
Dell Precision 650, RedHat 9, no sound
how to trace the cause resulting in the crash of bind server
Virus on the list
UNINSTALL RPM MYSQL
usb pen drives: mounting as a user
broadcom network interface
make mrproper
sendmail configuration on redhat
Couldn 't open PID file /var/run/named/named pid Permission denied
Promise 378 controller
kernel 2 6 and /dev/sound/mixer not found
Problem using up2date
mrtg step by step howto/configuration for a newbie?
Compiling and Installing Kernel 2 6
Can 't locate module ppp0, can 't locate module ppp compress 21
HOW I CAN MAKE BOOTABLE FLOPPY DISKET
Lotus Notes under Wine
/etc/security/limits conf question
Intel E/1000 driver
Command stream end of file while reading
rpm database corrupt
qla2300 modules
 
Search:  
Power your search with and, or, +, -, or "some phrase" operators.
Help Me with shell script please

Help Me with shell script please

2004-01-16       - By Ben Yau

 Back
Reply:     1     2     3     4     5     6     7     8     9     10     >>  


>
> Hello All,
>
> I want to send the same mail massage to 100 people, but not in a way doing
> CC or BCC, but just a mail to a unique person...
> I have this 100 people email addresses in one file. The question is this:
> Is there a way to write some script which will do this job ?
>

Here is a basic basic way to do it with on checks. By the way, can you log
in and run the script from the user whose email address you want the mail to
come from? THat makes it easier since you an use the "mail " command. If
not, it is a bit more convoluted (at least for me) since then I use the
"sendmail " command.

Assume your mail message is in message.txt and your emails are in email.txt
(one address per line, no blank line at the end please)
(by the way , i was laughing when you mistyped message as "massage ".
Imagine if you did "mail " as "male " and I 'd be like that 's something
interesting to send out to 100 people

Okay..disclaimer: untested, non-guaranteed . Change pathnames as you see
fit. No sanity checks.

--8 <-- snip --8 <---
#!/bin/bash
#    script for simple bulkmailing

# get the addresses
alist=`/bin/cat ./emails.txt`

# enter loop for each address
for a in $alist
do
    #verbose output danka
echo "mailing to $a "

    #mail away
cat message.txt | mail -s "insert subject of message here " $a

    #traffic control
    sleep 3
done

---8 <--- snip ---8 <---


that should be it. If you need to change the "From " email address, let me
know. It will get a bit more tricky. For 100 people, this should be
sufficient. For more than 100, there are a lot more things you 'd want to do
with the script that will keep you and your server from getting bogged down.

Also, I recommend that when you run the script you redirect the output to a
text file
lke output.txt and then in a separate window keep track of what 's going on
with

tail -f output.txt

That way if the program crashes or mail server crashes you still have
output.txt so you can see what addresses have been sent to and which
haven 't.

Good luck
Ben Yau


--
redhat-list mailing list
unsubscribe mailto:redhat-list-request@(protected)?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list