>I'm using a trivial shell script to uuencode and mail a file:
>uuencode $1 $1 | mailx -s $1 $2
>I would like to keep a log file of the message headers so I'll know what
>I mailed to whom and when. Is there some way to capture the header off
>the message?
The best way that I can think of is to point the sendmail
variable in your ~/.mailrc file to a script that will grep out
what you want into a file then send the complete message to
your actual /full/path/sendmail program.
In fact, if you do this you can process all your messages in all
sorts of ways before they are actually sent. I use this method
to append random signatures and quotes to my email (and random
sigs to my usenet postings).
You can also save ALL your outgoing messages by setting the
record variable in ~/.mailrc to a filename, eg:
========8<----insert-crowbar-here------------------------------
# ~/.mailrc
#...
set folder='mail'
set outfolder='mail'
set record='+outbox'
========8<----insert-crowbar-here------------------------------
However, as you are using an actual shell script to do this
anyway, why not do something like this:
========8<----insert-crowbar-here------------------------------
#!/bin/sh
echo "To: " $2 > /tmp/uu.$$
echo "Subject: " $1 >> /tmp/uu.$$
echo "From: " [your_email_address] >> /tmp/uu.$$
uuencode $1 $1 >> /tmp/uu.$$
grep [whatever_string] /tmp/uu.$$ >>! ~/outmailheaders
sendmail < /tmp/uu.$$
rm /tmp/uu.$$
========8<----insert-crowbar-here------------------------------
(Completely off the top of my head... correct as necessary).
This sends the message directly to sendmail, bypassing mailx
altogether. Much more efficient (although it does use a
temporary file).
Cheers
Tony
_______________________________________________________
_______| Tony Nugent | Griffith University |______
\ | | Brisbane, Queensland, Australia | /
\ |-------------------------------------------------------| /
/ |_______________________________________________________| \
/__________) (_________\