Re: script to send out a dozen letters?
- From: Chris Cowart <ccowart@xxxxxxxxxxxxxxxxxxxx>
- Date: Mon, 17 Aug 2009 15:44:04 -0700
Gary Kline wrote:
if there are tools to do this, please point me at them, but i
want to send out a snail and/or email|HTML|whatever to a handful
of companies that i hope to find online.
I'm guessing the inside address would me something like
Company Name
Address
Company Email
Attn Mr. Smith:
[my canned letter]
i forget if the inside address is before the recipient
address--I *think* so. is there a way of having date output
the format "15 August, 2009" rather than my usual, 15aug09?
I am pretty sure these people are most accustomed to GUI/html
mail, so is there a way of invoking evo with html capability?
if there are web pointers on this, puleeze clue me in!
Here's a script I whipped up a year or two ago that sends out e-mails.
You could definitely tweak it to find/replace a LaTeX template and send
it directly to the printer (circa the `| sendmail` line). See the
included readme (excuse the twiki formatting). While it was written for
bash, it may run under /bin/sh (but I make no claims).
It's really straightforward. I would die a little inside if it were used
to send HTML e-mail, but there's nothing to stop you from writing HTML
(by hand) into the template (or saving a message out of your GUI MUA of
choice into a flat file and using that as your template).
--
Chris Cowart
Network Technical Lead
Network & Infrastructure Services, RSSP-IT
UC Berkeley
#! /bin/bash
if [ -z "$1" ] || [ -z "$2" ] || [ "x$1" == "x--help" ]; then
printf "Usage:\n\t${0} data_file template_file [cc1 [cc2 ... ]]\n"
exit 1
fi
data="$1"
shift
template="$1"
shift
exec 0<${data}
read line
FIELDS="$(echo $line | tr ';' ' ')"
while read line ; do
column=1
SCRIPT=""
email=""
for field_title in $FIELDS ; do
datum=$(echo "$line" | cut '-d;' "-f${column}")
SCRIPT="${SCRIPT:+${SCRIPT};}s:$field_title:$datum:"
column=$(($column + 1))
if [ "$field_title" = "EMAIL" ] ; then
email="$datum"
fi
done
printf "Mailing %s... " "$email"
sed "$SCRIPT" "$template" | sendmail "$email $@" || {
echo "Something error happened" ; continue; }
printf "Success!\n"
done
---+ Overview
The =automail= script allows you to send templated e-mails to a list of
recipients. This is particularly useful during hiring.
---+ Usage
The =automail= script is installed on hal.
---++ The Data File
You must prepare a file with the data that will be used to fill in the
templates.
The first line of this file includes the case-sensitive field names,
separated by semi-colons. Each subsequent line is a data record. One e-mail
will be sent for each data record in the file.
*Example:*
<verbatim>
EMAIL;LNAME;FNAME;FOOD
ccowart@xxxxxxxxxxxxxxxxxxxx;Cowart;Chris;Bananas
keenanp@xxxxxxxxxxxxxxxxxxxx;Keenan;Parms;Ice Cream
jeremydw@xxxxxxxxxxxxxxxxxxxx;Jeremy;Weinstein;Rabbit Food
</verbatim>
Call this file ~/email_data.
*Note:* The only column title with special meaning is "EMAIL" and it *must*
appear in the data file. All other columns follow brain-dead substitutions
and do not affect the behavior of the automailer.
---++ The Template File
Here, you compose your e-mail. Note you must conform to RFC822 (Here's a
summary of the relevant points):
* You must include the To, From, Cc, and Subject headers.
* Headers must be properly formatted (=Name: Contents Can Have Spaces=)
* The headers end with a blank line. There must be a blank line before
you begin your message.
*Example:*
<verbatim>
From: The Party Planning Committee <ppc@xxxxxxxxxxxxxxxxxxxx>
To: FNAME LNAME <EMAIL>
Subject: The Potluck
Hello FNAME,
Please remember to bring FOOD to the potluck.
Thanks,
The Party Planning Committee
</verbatim>
Call this file ~/email_template.
*Note:*
* Column titles (see The Data File section) will be substituted with the
current record's column contents. The address in the EMAIL column will
receive a copy of the message.
* Including a Cc or Bcc header in the template will *NOT* affect who
receives a copy of the message.
*Warning:* The recipient will receive the message AS-IS.
__Bcc Headers will not be filtered__.
---++ Sending the Message
After you declare the data file and template file (in that order), you may
add e-mail addresses to the command line (e.g., hiring@xxxxxxxxxxxxxxxxxxxx).
Note that other than the recipient address, no addresses (Bcc or Cc) are
parsed from your message's headers. As such, if you have cc or bcc recipients,
you must declare them here. Note also that declaring recipients here does
*not* affect the To/From/Cc/Bcc headers in the actual e-mail message.
=automail ~/email_data ~/email_template cc_address1 bcc_address2=
Attachment:
pgpCfSb7O32Sw.pgp
Description: PGP signature
- Follow-Ups:
- Re: script to send out a dozen letters?
- From: Gary Kline
- Re: script to send out a dozen letters?
- References:
- script to send out a dozen letters?
- From: Gary Kline
- script to send out a dozen letters?
- Prev by Date: Re: Packages available for different FreeBSD versions
- Next by Date: freebsd-update to -BETA2 p1
- Previous by thread: Re: script to send out a dozen letters?
- Next by thread: Re: script to send out a dozen letters?
- Index(es):
Relevant Pages
|
Loading