head	1.1;
access;
symbols
	release-2-3-0-final:1.1
	release-2-2-6-final:1.1
	release-2-2-5-final:1.1
	release-2-2-4-final:1.1
	release-2-2-3-final:1.1
	release-2-2-2-final:1.1
	release-2-2-0-final:1.1
	release-2-1-0-rc3:1.1
	release-2-1-0-rc2:1.1
	release-2-1-0-rc1:1.1;
locks; strict;
comment	@# @;


1.1
date	2003.06.13.16.07.21;	author agmsmith;	state Exp;
branches;
next	;


desc
@@


1.1
log
@A bash script file for customizing a template letter with information
from a "people" file.
@
text
@#!/bin/sh

# Make a mail merge letter by combining data from a given people file and a
# template letter text file.
# $Revision:$
# Some code from Scot Hacker's PeoplePorter http://www.bebits.com/app/1747

PeopleFile=$1
echo "Mail merging using people file: $PeopleFile"

Name=$(catattr META:name "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
EMail=$(catattr META:email "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)
Company=$(catattr META:company "$PeopleFile" | sed s/\ \:\ /%/g | cut -f3 -d\%)	

sed "s/NAME/$Name/g" <TemplateLetter.txt >/tmp/stage1
sed "s/EMAIL/$EMail/g" </tmp/stage1 >/tmp/stage2
sed "s/COMPANY/$Company/g" </tmp/stage2 >/tmp/stage3
mail -v -s "Test Message to $Name" "$EMail" </tmp/stage3
@
