On Mon, 3 Jun 2013, Paul Heinlein wrote: > That was an exercise left to the reader :-) because I don't know how you > currently store and retrieve your recipients' e-mail addresses.
Paul, Well, ... this reader could not find any examples to use as templates. Names are in simple text files, not in any application. > If all the file contained was the greeting name and e-mail address, you could > separate them anyway you'd like. OK. Now, the file contains only the e-mail address. I'll add the addressee's name to it ... > A CSV format would be easy, but it might break if the greeting name > included a comma. A more robust file might use a colon, which is unlikely > to occur in your data. ... using a colon. No name has a comma; they're all first names. > Here's a trivial example: Thanks. > A script that used those files -- here assumed to be named subscribers.txt > and news.m4 -- might work something like this: > > while read LINE; do > ADDR=$(echo $LINE | cut -d: -f1) > GRTG=$(echo $LINE | cut -d: -f2) > m4 -D GREETING="$GRTG" news.m4 | mail -s 'June News' $ADDR > done < subscribers.txt This is an expanded version similar to the one-line script I used with mailx. Looks good. > There are, of course, several different ways to accomplish the same task, but > that might get you started. As with everything GNU there are multiple solutions to every problem. :-) As long as the above works I won't devote more time to looking for different solutions. > An m4 template, by the way, is easy to construct and test, because by > default m4 sends output to /dev/stdout. Aha! I missed that when I read the docs. Certainly makes it easy to test. Much appreciated, Rich -- Richard B. Shepard, Ph.D. | Have knowledge, will travel. Applied Ecosystem Services, Inc. | <http://www.appl-ecosys.com> Voice: 503-667-4517 Fax: 503-667-8863 _______________________________________________ PLUG mailing list [email protected] http://lists.pdxlinux.org/mailman/listinfo/plug
