On Sun, 28 Dec 2008 12:01:02 -0500
Vince Sabio <vi...@vjs.org> wrote:

> I'm looking for a perl script that can create an e-mail message with 
> a custom header (i.e., customized header-From and To lines, and 
> ideally customized envelope-From, so that I can route bounces to a 
> different address). I'm willing to bet that such a script already 
> exists in the wild, and would thus prefer to avoid reinventing the 
> wheel.
> 
> The script does not need to be fast; I'm setting this up for my HOA 
> to send e-mail to the members, so we're only talking about 50 or so 
> e-mails on each send. I can do the rest of the customization 
> required, but was figuring that the open-pipe, write-to-pipe, 
> close-pipe piece was already done.

Maybe not, since there's a pretty trivial way to do it from the shell:

__________________________________________________________________________
#!/bin/csh
# smail.  Invoked as smail file subject address
#
# TODO : detection of charset from the players and of Quoted-printable
#
# Takes parameters:
# $1: File to send
# $2: Subject
# $3: Email of destination
#
date >>mail.log
echo "===== mail sent to $3/$2" >>mail.log
# Following command must be sendmail (even exim, postfix or others
provide it) # as mail does not seem to allow to define headers ourselves
/usr/sbin/sendmail -f boun...@example.com $3 << EOF
From: List <l...@example.com>
To: $3
Subject: $2
Comments: Using sendmail
Organization: ExampleDotCom
List-ID: The ExampleDotCom Example
 <http://www.asciiking.com/diplomacy/usak/> 
List-Help: <mailto:list-ow...@example.com?body=help>
List-Unsubscribe:
 <mailto:list-ow...@example.com?subject=remove%20me>
List-Subscribe:
 <mailto:list-ow...@example.com?subject=add%20me
List-Owner: <mailto:list-ow...@example.com> 
List-Post: NO
X-Recipient: $3 
X-Mailer: Shell Script
MIME-Version: 1.0
`cat $1`

EOF
__________________________________________________________________________





Reply via email to