RE: Using /etc/aliases with groups

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

 



Let's go old school Unix for a bit; because what you want to do isn't going to work with sendmail alone!  Add an entry in your aliases file:

\allusers: "|/etc/mail/mailallusers.sh"
(The \ prevents someone from further aliasing 'allusers')

Then create a script like the following (note this script may not be prefect, I'm on a Mac and writing it from memory, not a Unix box where I can test it).

#/etc/mail/mailallusers.sh
#!/bin/sh

me=`who am i | awk -F '{ print %1 }'`

for f in `cat /etc/group | grep '^users\:'`
do
    echo "Mailing $f" >> /tmp/mail_log.$$
    
    Mail $f < - >> /tmp/mail_log.$$
    Mail $me < /tmp/mail_log.$$
    
    rm /tmp/mail_log.$$
done
#end

Now the only caveat that I can think of is that I'm not sure if sendmail passes the message as stdin to the aliases program (the '-' on the first mail line signifies stdin); you may want to check that.  But back in the old school Unix days, we used to hand crank out mail processing scripts just like this.  

Hope this helps.


-brian

Brian D. McGrew {brian@xxxxxxxxxxxxxxxxxxx || pacemakertaker@xxxxxxxx }
---
> Failure is not an option; it is included with every Microsoft product.


-----Original Message-----
From: redhat-list-bounces@xxxxxxxxxx
[mailto:redhat-list-bounces@xxxxxxxxxx]On Behalf Of Eucke Warren
Sent: Friday, September 03, 2004 4:24 PM
To: Redhat Support Usergroup
Subject: Using /etc/aliases with groups


I have been googling and I have not hit upon a keyword combination that will shed light on this.  I would like to create a Group for mass emailing users on a server.  I have tried  adding a line like

everyone:        users

but the email ends up being rejected.  This is a sendmail setup and, yes, I did run newaliases after altering the /etc/aliases file.  Anyone doing this?  Suggestions on how to implement?  I intend to only make the group alias live when we want to do the mass Email and will disable it once it is sent to prevent unauthorized use.

Thanks guys!

-Eucke
-- 
redhat-list mailing list
unsubscribe mailto:redhat-list-request@xxxxxxxxxx?subject=subscribe
https://www.redhat.com/mailman/listinfo/redhat-list


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

[Index of Archives]     [CentOS]     [Kernel Development]     [PAM]     [Fedora Users]     [Red Hat Development]     [Big List of Linux Books]     [Linux Admin]     [Gimp]     [Asterisk PBX]     [Yosemite News]     [Red Hat Crash Utility]


  Powered by Linux