Mailing from a script - 2

Gerald Combs gerald at ethereal.com
Wed Jun 20 04:08:27 CDT 2001


Um...  Why not simply add an "include" line to /etc/aliases?  As I recall,
the syntax is

list-address:	:include:/some/path/to/users.txt

This lets you manage addresses in users.txt while being able to send a
single message to list-address.  It's more efficient in that sendmail only
gets called once.

On Tue, 19 Jun 2001, Edgar Allen wrote:

> Forwarded message:
> >
> >Is there a way to send a mail message to a bunch of people who's mail
> >addresses are maintained in a file?
> >
> >Thought of a shell or perl script that would open the file and, for each
> >iteration of a loop, assign the line content to a variable and issue a mail
> >command, putting their address in the destination field.  Then assign the
> >next line (address) to the variable and loop again, until EOF.
> >
> #!/bin/bash
> # Send email to a list of names:
> #  Useage:  $0 "subject of msg" pathname2msgBody recipientFile
> name=nobody
> while [[ "$name" != "" ]]
> do
> if [[ "$name" != "nobody" ]] ; then
>     fastmail -f $LOGIN -s "$1" $2 "$name"
>     read name
> done <$3
> 
> This assumes one recipient per line in the recipientFile and queues
> individual messages so that delivery will be as fast as possible.
> 
> 
> 




More information about the Kclug mailing list