[rt-users] Include selected email headers

Steve Leibman sgl at exa.com
Tue Sep 9 16:42:32 EDT 2003


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, at 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: (.*)$/$1/;
     }
   }
   if ($tofield) {
     if ($ccfield) {
       $ccfield = "$tofield, $ccfield";
     }
     else {
       $ccfield = $tofield;
     }
   }
 }
 else {
   $ccfield = '';
 }
 $ccfield;
}

Thanks,
--
Steve Leibman         sgl at exa.com 




More information about the rt-users mailing list