On Mon, 20 May 2013, Rich Shepard wrote:

I use mailx to distribute newsletters to individuals in named lists. That list is then passed to mailx on the command line, along with the message and a subject line in double quotation marks. I want to learn if I can also add an individual greeting (specifically, the recipient's name) to the body of the mail.

The man page seems to suggest that a mailx guru could use the -S option to assign these names to a variable but I don't know how this would be done.

Has anyone here used mailx like this and can offer me suggestions. Or, are there other resources that might have examples of what I want to do?

I've never used -S, so I'm not sure what setting internal variables in mailx does. The tool I'd normally reach for in this situation is m4. If, for instance, you were able to loop through a list of subscribers and assign $NAME and $ADDRESS, then

  m4 -D GREETING="$NAME" newsletter.m4 | mail -s "Subject" $ADDRESS

The newletter.m4 would contain the GREETING token which would get replaced with $NAME.

--
Paul Heinlein
[email protected]
45°38' N, 122°6' W
_______________________________________________
PLUG mailing list
[email protected]
http://lists.pdxlinux.org/mailman/listinfo/plug

Reply via email to