getting xargs and mail to play nicely
Chris F.A. Johnson
cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Wed Jun 15 03:15:29 UTC 2005
On Tue, 14 Jun 2005, Peter King wrote:
> I want to do a (legitimate!) mailing of a single message to several
> recipients, and I'd like each to be the sole recipient specified in
> the email -- so no multiple addresses, cc, bcc, or suchlike. I have
> the recipients' addresses in a single text file, with one address per
> line in the file.
>
> How can I do a "mass mailing"?
>
> Why xargs, I thought, just grep through the address file and feed it
> to mail, and redirect the message:
>
> % grep @ addressfile | xargs -n1 mail -s SUBJECT < messagefile
>
> But this doesn't work: mail tries to take addresses from messagefile,
> not from addressfile. If I leave off the messagefile, then I send nice
> cheerful null emails to each person listed in addressfile.
grep @ addressfile |
while read addr
do
mail -s SUBJECT "$addr" < messagefile
done
--
Chris F.A. Johnson <http://cfaj.freeshell.org>
==================================================================
Shell Scripting Recipes: A Problem-Solution Approach, 2005, Apress
<http://www.torfree.net/~chris/books/cfaj/ssr.html>
--
The Toronto Linux Users Group. Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml
More information about the Legacy
mailing list