[fsck.com #2003] Re: [rt-users] mail to requestors and owners throughout ticket life

Phil Homewood pdh at snapgear.com
Wed Jan 29 19:17:00 EST 2003


Seth Cohn, EFN General Manager wrote:
> Can't call method "GetHeader" on an undefined value at
> /usr/share/request-tracker/lib/RT/Action/SendEmail.pm line 271, <GEN4>
> line 29.

Hmm. Looks like this can happen if the TransactionObj does
not contain a Message. I thought I guarded against this but
somewhere along the line I slipped.

Try the following patch over the top of what you already have...
-- 
Phil Homewood, Systems Janitor, www.SnapGear.com
pdh at snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
SnapGear - Custom Embedded Solutions and Security Appliances
-------------- next part --------------
Index: lib/RT/Action/SendEmail.pm
===================================================================
RCS file: /cvs/local/rt/lib/RT/Action/SendEmail.pm,v
retrieving revision 1.3.2.3
retrieving revision 1.3.2.5
diff -u -r1.3.2.3 -r1.3.2.5
--- lib/RT/Action/SendEmail.pm	29 Jan 2003 06:12:37 -0000	1.3.2.3
+++ lib/RT/Action/SendEmail.pm	30 Jan 2003 00:13:11 -0000	1.3.2.5
@@ -279,17 +279,21 @@
 
 sub SetMessageID {
   my $self = shift;
+  my $msg;
 
   # TODO this one might be sort of broken.  If we have several scrips +++
   # sending several emails to several different persons, we need to
   # pull out different message-ids.  I'd suggest message ids like
   # "rt-ticket#-transaction#-scrip#-receipient#"
 
-  $self->SetHeader('Message-ID',
-      $self->TransactionObj->Message->First->GetHeader('Message-ID')
-#        || "<rt-".$self->TicketObj->id().  "-".
-#        $self->TransactionObj->id()."." .rand(20) . "\@".$RT::Organization.">"
-  );
+  # Pull the Message-ID from the Transaction if we can, else make one up.
+  if ((defined ($msg = $self->TransactionObj->Message->First())) &&
+      (defined ($msg->GetHeader('Message-ID')))) {
+       $self->SetHeader('Message-ID', $msg->GetHeader('Message-ID'));
+  } else {
+     $self->SetHeader('Message-ID', "<rt-".$self->TicketObj->id().  "-".
+       $self->TransactionObj->id()."." .rand(20) . "\@".$RT::Organization.">");
+  }
 }
 
 


More information about the rt-users mailing list