[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] mass mail server



On Sat, 1 Apr 2000, RHLinux wrote:

> Hi guys
> 
> In the past, i seen a few questions, asking if it was possible to email
> every client on your server, heres how you can do it
> 
> Works great for me, its alot easier now emailing my clients to notify them
> of services updates and server news....
> 
> Regards
> Gary

-----
#!/bin/sh

SUBJECT='Mail from administrator'
MESSAGE='/tmp/message'

for $ACCOUNT in `cut -d':' -f1 /etc/passwd`
do
	mail -s "$SUBJECT" $ACCOUNT < $MESSAGE
done
-----
> 
> -----------------
> 
> cat /etc/passwd | awk -F : '{ printf("/usr/sbin/sendmail %s <
> message.txt\n", $1)}' > massmail.sh
> 
> then add a #!/bin/sh to the top of massmail.sh, and chmod +x it.  You'll
> also want to remove mailing accounts like root, lp(r), nobody, etc.
> 
> Create message.txt in the same directory as massmail.sh
> 
> message.txt should contain a suitably formatted message.  Something
> like:
> 
> From: Admin
> Subject: whatever
> 
> Message Text
> 
> To run script, just type in /path/massmail.sh
> 
> I ran it as admin and it worked fine, if not, then su to root and then it
> should work, the 1st time it worked a charm, then the next time, i forgot to
> add the #!/bin/sh and chmod it...you will have to run it everytime you want
> to send a message, in case your clients added a extra email account or
> something...
> 
> 
> 
> _______________________________________________
> cobalt-users mailing list
> cobalt-users@xxxxxxxxxxxxxxx
> To Subscribe or Unsubscribe, please go to:
> http://list.cobalt.com/mailman/listinfo/cobalt-users
> 

-- 
|Colin Smith:  Colin.Smith@xxxxxxxxxxxxxxxxxxxx  |   Windows 2000    |
|Configuration management library for Unix/Linux |        AKA        |
|    http://www.yelm.freeserve.co.uk/libcfg/     |    The W2K Bug    |