Accessing SMTP headers via TicketSQL or REST2 in RT5?

I need to extract a list of ticket Ids of tickets that include emails with specific custom SMTP header values. I can do that in bulk by querying the database column Attachments.Headers. I can also iterate through Tickets and related Transactions in Perl and scrutinize $transaction->Attachments->First->Headers();

However, I would like to empower regular users to do same using TicketSQL searches and/or by issuing calls against the REST2 interface.

Any suggestions?

Which version of rt are you on? In rt 5 there is the transaction query builder that can most likely do this.

You could also write a scrip in rt that runs on create/correspond and set a custom field based on if that smtp header is present ( could even do this per transaction )

Extracting the header(s) into a custom field via a scrip on transaction create is definitely the most reliable option - if I knew which SMTP headers are wanted well in advance of eventually needing them.

I’m on RT 5.0.0 so I have access to the transactions query builder and I thought I’d be able to do something along the lines of:

TYPE = ‘Create’
AND Field LIKE ‘Headers’
AND NewValue LIKE ‘X-Tempestdg-Emailid’

but no joy. As an experiment I turned on every available column and searched for a specific transaction id - one where I can surface the SMTP header of interest by toggling ‘show full headers’ in Display.html - and, sadly, no SMTP headers are visible anywhere.