From Joe Novielli 

NOTES:

For those of you who want to append a tail (or signature) message to every email that is sent to a list, please do the following.  ( I developed the script on Sun Solaris 2.5.1, but it should work everywhere PERL is installed)



STEP 1:) Added or modify the line in your "aliase" file that points to your list. Don't worry I call the catmail utility from my script.  (rebuild the aliase database- eg: /usr/lib/sendmail -bi)
eg: LIST_NAME:  "|/export/home/lprocuser/append.pl"

STEP 2:) Cut and paste the script below to the path specified in STEP 1.
Please change the variable $listname to point to your list.

----------------------------------- Script below (append.pl)

#!/usr/local/bin/perl
## Developed by Joe Novielli for Matrox Electronic Systems (jnoviell@matrox.com)
### This script appends a message to every mail that is received by a list
# three  variables (only $listname need to be modified)
$listname='LIST_NAME';
$no_more_header='TRUE';
$tail='TRUE';
open(CATMAIL,"| /export/home/lprocuser/catmail -L $listname -f");
# READ STDIN (FROM email received) while (<>) 
        {
$line=$_;
print CATMAIL "$line";

## This if statement determines if a mesage already has a tail
(as in forwards) therefore do not append another tail
if ($line =~ /#######\s*TAIL_ME\s*###############/) 
           {
$tail='FALSE';
           }
} #end while
if ($tail eq 'TRUE')
        {
print  CATMAIL "\n"; print  CATMAIL "#######  TAIL_ME  ###############\n";

        }
close (CATMAIL);
exit;
--------------------------------- END OF SCRIPT


Step 3:) Test and modify if desired
Step 4:) Done

