[rt-users] Message ID generation

Florian Weimer Weimer at CERT.Uni-Stuttgart.DE
Mon Mar 11 16:17:14 EST 2002


Bruce Campbell <bruce_campbell at ripe.net> writes:

> On Mon, 11 Mar 2002, Florian Weimer wrote:
>
>> sub SetMessageID {
>>
>>   # TODO $RT::rtname should be replaced by $RT::hostname to form valid
>>   # message-ids (ref rfc822)
>>
>>   $self->SetHeader
>>     ('Message-ID', "<rt-".$self->TicketObj->id().
>>      "-".
>>      $self->TransactionObj->id()."." .rand(20) . "\@".$RT::rtname.">")
>>       unless $self->TemplateObj->MIMEObj->head->get('Message-ID');
>> }
>>
>> Is it safe to change $RT::rtname to something else in this context?
>> In our case, $RT::rtname isn't a FQDN. :-/
>
> You could change it to $RT::hostname, and ensure you set $hostname in
> etc/config.pm to something that is a FQDN .  Eric and I will cry though
> (we're doing seperate work regarding MessageId handling) ;)
>
> Seriously though, go right ahead.

Okay, here is a patch.

Index: etc/config.pm
===================================================================
RCS file: /raid/cvsroot/rt/etc/config.pm,v
retrieving revision 1.17
diff -u -u -r1.17 config.pm
--- etc/config.pm	2002/02/18 21:36:46	1.17
+++ etc/config.pm	2002/03/11 21:13:22
@@ -219,6 +219,11 @@
 
 $CommentAddress='RT::CommentAddress.not.set';
 
+# $MessageIDDomain controls the domain of the Message-ID for outgoing
+# messages (the part after the @ sign).  The default assumes that
+# $rtname is a fully qualified domain name.
+
+$MessageIDDomain = $rtname;
 
 #Sendmail Configuration
 
Index: lib/RT/Action/SendEmail.pm
===================================================================
RCS file: /raid/cvsroot/rt/lib/RT/Action/SendEmail.pm,v
retrieving revision 1.3
diff -u -u -r1.3 SendEmail.pm
--- lib/RT/Action/SendEmail.pm	2002/02/28 06:49:09	1.3
+++ lib/RT/Action/SendEmail.pm	2002/03/11 21:13:22
@@ -227,12 +227,9 @@
 
   $self->SetHeader
     ('In-Reply-To', "<rt-".$self->TicketObj->id().
-     "\@".$RT::rtname.">");
+     "\@".$RT::MessageIDDomain.">");
 
 
-  # TODO $RT::rtname should be replaced by $RT::hostname to form valid
-  # message-ids (ref rfc822)
-
   # TODO We should always add References headers for all message-ids
   # of previous messages related to this ticket.
 }
@@ -253,13 +250,10 @@
   # pull out different message-ids.  I'd suggest message ids like
   # "rt-ticket#-transaction#-scrip#-receipient#"
 
-  # TODO $RT::rtname should be replaced by $RT::hostname to form valid
-  # message-ids (ref rfc822)
-  
   $self->SetHeader
     ('Message-ID', "<rt-".$self->TicketObj->id().
      "-".
-     $self->TransactionObj->id()."." .rand(20) . "\@".$RT::rtname.">")
+     $self->TransactionObj->id()."." .rand(20) . "\@".$RT::MessageIDDomain.">")
       unless $self->TemplateObj->MIMEObj->head->get('Message-ID');
 }
 
-- 
Florian Weimer 	                  Weimer at CERT.Uni-Stuttgart.DE
University of Stuttgart           http://CERT.Uni-Stuttgart.DE/people/fw/
RUS-CERT                          +49-711-685-5973/fax +49-711-685-5898




More information about the rt-users mailing list