Roberto Samarone Araújo (RSA) wrote:
 
>                 I would like to know how can I create an email , so when
> I send a message using this email it will send a copy of it to all users in
> my email system including virtual emails but , if an user try to make a
> reply of this email , it only will send a email to the email that I use to
> send to all user and not to all users in my server . I don't want to create
> a moderated mailing list to do it .

Here's a script I use but I don't remember where it came from so if 
anyone on the list recognizes it as theirs, speak up!

#!/bin/sh
# Build list of users from /etc/passwd starting with
# Line 18 so we don't send mail to non-users.
#
# Adjust below if statement to match your system.
# 
(
cat /etc/passwd | awk '
BEGIN{
  FS=":"
  cnt=1
}
{
  if(cnt < 18){ cnt++ ; next }
  printf "[EMAIL PROTECTED]\n",$1
  cnt++
}'
) | grep -v qmail | grep -v alias | grep -v orders | grep -v ftp | grep -v
test 
| grep -v spop3d > /tmp/mail_list
#
# You may need to use grep -v statement in for
# loop below if you have added automated users
# ie: postgres, etc.. to filter out.
#
# Now to email out to the users.
for user in `cat /tmp/mail_list`
do
   /var/qmail/bin/qmail-inject ${user} < MailMessage
done

rm -f /tmp/mail_list
# End script


To use it, you can put it in your home dir (that's what I do) and create
a file called MailMessage.  At the top of the file put a To:, From:, and
a Subject: line, then a blank line, then your message.  Edit the above
script to put your domain in in place of YOURDOMAIN.HERE.  Run the script.
You may also want to edit the list of greps near the top to match your 
system.  I noticed yesterday that I need to add dnscache and tinydns to
the list.  Also the (cnt < 18) change the 18 to the line number of your
first user in /etc/passwd. 

Vince.
-- 
==========================================================================
Vince Vielhaber -- KA8CSH    email: [EMAIL PROTECTED]    http://www.pop4.net
 128K ISDN from $22.00/mo - 56K Dialup from $16.00/mo at Pop4 Networking
        Online Campground Directory    http://www.camping-usa.com
       Online Giftshop Superstore    http://www.cloudninegifts.com
==========================================================================



Reply via email to