1. Read in the message piped to the script line by line 2. Append the data to a temporary file 3. Do not write the "from" line or the "to" line to file 4. Save the "from" off into a variable 5. Parse the /etc/passwd to build a "recipient" list 6. system (cat $tmp|sendmail -bm -f"$from" "$recip"); #### #/usr/bin/perl -w use strict; open (TMPOUT,">/tmp/somefile"); my $from; my @recipients; while (<>) { print TMPOUT unless (/^From: /i || /^To: /i); ($from = $_) =~ /Some regex to get from/ if (/^From: /i); } close (TMPOUT); open (PASSWD,"/etc/passwd"); while () { my @fields = split ":" , $_; push @recip , $fields[0] unless (#system account); } system (cat /tmp/somefile|sendmail -bm -f"$from" "@recips"); unlink "/tmp/somefile";