Include selected email headers

Howdy folks,

I have RT configured in such a way that a group of people
are notified “OnCreate”. The problem is that I want these
people to know exactly who was on the recipient list of
the initial email that created the ticket (including any
Cc’s, etc). So I want to preserve the original Cc header,
and include it in the email that gets sent as a result of
the scrip triggered “OnCreate”. I’ve been trying to do it
by including something like the following in a template,
but my newly-created "X-Original-cc: " field never shows up.
Does anybody have any experience accomplishing something
along these lines?

the following text sits at the top of the body of a template:

X-Original-cc: {
if ($Transaction && $Transaction->Message->First) {
my ($field,$tofield,$ccfield,@hdr);
my $hdrs=($Transaction->Message->First->Headers);
(@hdr) = split /\n/,$hdrs;
while ($field = pop @hdr) {
if ($field =~ /^Cc: /) {
($ccfield = $field) =~ s/^Cc: (.)$/$1/;
if ($field =~ /^To: /) {
($tofield = $field) =~ s/^To: (.
if ($tofield) {
if ($ccfield) {
$ccfield = “$tofield, $ccfield”;
else {
$ccfield = $tofield;
else {
$ccfield = ‘’;

Steve Leibman