[comp.unix.wizards] SEX! or, how do I mail to a lot of unix users?

thermal%solgel.hepnet@CSA2.LBL.GOV (05/31/90)

I would like to be able to send a mail message to all the users on
a unix machine.  Of course, I could do it the long way, that is,
do a 'finger' or 'who', thus getting a list of all the users, and
then sending a mail message to each, one at a time.  Is there a
quicker way? (it seems to me there could be two or three different
ways, such as setting up a mailing list, or some nifty command that
will do this on one stroke of the finger).  Obviously, I'm not a
unix guru or wizard, so make your explanation understandable, please.

Thanks, Dana

jdarcy@zelig.encore.com (Mostly Harmless) (05/31/90)

thermal%solgel.hepnet@CSA2.LBL.GOV:
> I would like to be able to send a mail message to all the users on
> a unix machine.  Of course, I could do it the long way, that is,
> do a 'finger' or 'who', thus getting a list of all the users, and
> then sending a mail message to each, one at a time.  Is there a
> quicker way? 

The simplest way I can think of is:

    mail `awk -F: '{print $1;}' < /etc/passwd`

This simply extracts the username field from every entry in /etc/passwd.  Of
course, if you're using YP you'll have to do something more like:

    mail `ypcat passwd | awk -F: '{print $1;}'`

I'm sure you get the idea.

Jeff d'Arcy, Generic Software Engineer - jdarcy@encore.com
      Nothing was ever achieved by accepting reality

jak@sactoh0.UUCP (Jay A. Konigsberg) (06/02/90)

In article <900531083151.30e0b91a@Csa2.LBL.Gov> thermal%solgel.hepnet@CSA2.LBL.GOV writes:
>I would like to be able to send a mail message to all the users on
>a unix machine.  Of course, I could do it the long way, that is,
>do a 'finger' or 'who', thus getting a list of all the users, and
>then sending a mail message to each, one at a time.  Is there a
>quicker way? (it seems to me there could be two or three different
>ways, such as setting up a mailing list, or some nifty command that
>will do this on one stroke of the finger).  Obviously, I'm not a
>unix guru or wizard, so make your explanation understandable, please.
>
>Thanks, Dana


Write a shell script named "mall" (mail all - but I love the name).
It scans the /etc/passwd file and extracts those login names with
UID >= 100. You can also have an optional filename with the login
names you want the message sent to.

One note: doing this will probably mean that some of the mail will
sit unread in /usr/mail (or /usr/spool/mail), so be careful how you
write it. Accuctally, someone out there might have already written
it.

ac1@rosemary.cs.reading.ac.uk (Andrew Cunningham) (06/03/90)

In article <11990@encore.Encore.COM> jdarcy@zelig.encore.com (Mostly Harmless) writes:
>thermal%solgel.hepnet@CSA2.LBL.GOV:
>> I would like to be able to send a mail message to all the users on
>
>The simplest way I can think of is:
>
>    mail `awk -F: '{print $1;}' < /etc/passwd`
>

If all users home directories are in the same place (e.g. /users/ac1,
/users/someone, /users/foo etc)   then you can do

		cd /users; mail *

At worst you might have to do this two or three times to get all users on the
whole system.  Remember that there will be a copy made of the message for EVERY
user you send it to - which could amount to a lot of disk space!


AndyC



#include <disclaimer.h>    When in doubt, use brute force - Ken Thompson 
"Truly, the way of enlightenment is like unto half a mile of broken glass"
		-- Ignatious Cutwell, B. Mgc. (UU)
ARPA:		ac1%csug.cs.reading.ac.uk@{ucl-cs.arpa,nsfnet-relay.ac.uk}
UUCP:		ac1%csug.cs.reading.ac.uk@ukc.uucp           /* one of these */
Internet:	ac1%csug.cs.reading.ac.uk@cunyvm.cuny.edu    /* must work! */
JANet:		ac1@uk.ac.reading.csug.cs

campbell@Thalatta.COM (Bill Campbell) (06/06/90)

In article <3198@sactoh0.UUCP> jak@sactoh0.UUCP (Jay A. Konigsberg) writes:
>In article <900531083151.30e0b91a@Csa2.LBL.Gov> thermal%solgel.hepnet@CSA2.LBL.GOV writes:
>>I would like to be able to send a mail message to all the users on
>>a unix machine.  Of course, I could do it the long way, that is,
>>do a 'finger' or 'who', thus getting a list of all the users, and
>>then sending a mail message to each, one at a time.  Is there a
..deleted

This idea seems like just another way to create junk mail akin to
the COWABUNGA bullshit that is happening around the net now.  It
would seem a politer way to do this would be to mail to
postmaster@machine and then the postmaster could handle
distribution.

The idea of bulk-mailing on the internet makes Morris's worm seem
benign.
-- 
....microsoft--\                    Bill Campbell; Celestial Software
...uw-entropy----!thebes!camco!bill 6641 East Mercer Way
....fluke------/                    Mercer Island, Wa 98040
....hplsla----/                     (206) 232-4164