Email Header Change "References"

I have a Sendmail_local.pm in place. I need to know how to change the “References” feild in the email header.
I need it to be equal to the subject. I tried the following.

	$self->SetHeader(Subject => $subject); --- Works fine
	$self->SetHeader(References => $subject);  --- Does not seem to have an effect.

Thanks in advance for the help.

RT automatically fills a References header, so it is probably being overwritten later.

In any case, what you want seems a very bad idea, since the References header must “contain one or more unique message identifiers, optionally separated by CFWS.” see rfc5322.
Your subject will not comply with this.

1 Like

Thanks for the response

So here is the issue and what I am being told as to why it is not working.

I am trying to respond to a 3rd party ticketing system to automatically accept ticket created in said system and then sent to RT4. RT4 is using an auto reply script with action “Autoreply to Requestors”. The developer told me that the accepting process is not working because RT4 is changing the “References” field in the header.

Example given to me.
References: <RT-Ticket-1530111@Copsean_Service_Inc> – incorrect

Should be something like this:
**References: CP.9999999.jrk29m3jfo2hlw.0.1033.kfsjcwoyj938fwrnw3fnkrh3kfpdimxz (this is not a correct data and shows only approximate format)

My question unrelated to coding is this other developer correct?

Also looking through the inbound message there is not a “References” field in the header.

So another question is where would I get this information from?

I have this type of process working for other vendors. I did get help to write a local SendMail module so I can manipulate the subject for some of these other ticketing system which help a ton.

Again Thanks for the help.

You are trying to identify an incoming email from another ticketing system based on if the reference field is of a specific format? And if it is found to be the case where the email is from another system you want to do some action?

No I have that side of the equation figured out. The issue is the response that is being sent from RT4 to the other ticketing system.

After doing some more searching of email headers it looks like I need to change the “References” field value to the original inbound messages ID value.

Thanks

Here is what RT4 is responding with

References: <RT-Ticket-1538334@Copsean_Service_Inc>
CP.3783199.2934v.0.1033.8d1fb31287a1471081cb8b475ad4b357@am.corrigopro.com

The receiving ticketing system developer is saying that their system needs to have the following in the “References” field.

References: CP.3783199.2934v.0.1033.8d1fb31287a1471081cb8b475ad4b357@am.corrigopro.com

This value is the original message ID.

So what I need is to know how to override RT4 to have the original message ID on the References field value.

Thanks

I believe you can use the SetHeader method as you tried originally, you just need to find where RT sets the reference header and ensure that your code runs after RT sets the reference header.

Be careful messing with the References header though, as future replies from the 3rd party ticketing system back into your RT may not be recognised as part of the same ticket, and thus your RT may open yet another new ticket.

Also it looks to me that you include their format already in your references. The References header in a mail thread builds up over time, so you should have both their form of reference (referring to emails from them that you received) and the RT format (referring to emails RT has sent to them). If they aren’t handling that, it sounds like their ticketing system mail handling is a bit…um… “broken”. :slight_smile:

1 Like

Something I have just noticed

When I send via the autoreply the Reference field value is
References: <RT-Ticket-1538334@Copsean_Service_Inc>

But when I use the reply button on the ticket the Reference field value is
References: <RT-Ticket-1538334@Copsean_Service_Inc>
CP.3783199.2934v.0.1033.8d1fb31287a1471081cb8b475ad4b357@am.corrigopro.com

Why the defference?

Thanks

I believe most email clients edit the reference field, so the second value in your example is probably from another client

These processes were all done from inside RT4 both email were produced by RT4.

Same client.

Thanks