[SunHELP] Add header to the top of the body of every e-mail (sendmail)

zsentient zsentient at anosc-e.5sigcmd.army.mil
Tue Aug 5 10:51:20 CDT 2003


I know this question has been asked, but want to put it out there again with the hope some fresh brain matter can give it a spin.

I am trying to echo an e-mail header (not mail header, header as in document terminolgy) to all text e-mail bodies coming from a solaris system using a shell script that is basically wrapping /usr/lib/sendmail. 

I am aware of mimedefang, but it only runs with Sendmail version 12 (at this time I can not upgrade) and it is a little more than I actually need...

-This is the mail command that I must use: 
# /usr/ucb/mail -r "reply_address at domain.com" -s "E-Mail Subject" "recipeint at domain.com"  < ./txt_file

-Here is the script that is attempting to add (echo) "[For Official Use Only]"  into the top of the body of every e-mail. With the echo "\n[For Official Use Only]" the subject is wrongly moved to the body of the e-mail, but the header does appear; without the "\n" in the header does not appear at all: 

#!/bin/sh
# Sendmail wrap script to add header and footer.
# Script is named as /usr/lib/sendmail and sendmail binary moved to /usr/lib/sendmail.nowrap
# Permissions of script set to match original sendmail binary: 
#-r-xr-sr-x   1 root     other        167 Aug  5 12:48 sendmail
        {
        #echo "[For Official Use Only]" 
        echo "\n[For Official Use Only]" 
        cat -
        }| /usr/lib/sendmail.nowrap "$@"



More information about the SunHELP mailing list