Actual correspondence recipients in notification template

Hi all,

TL;DR:

  • How to include in a template the actual recipients of a
    correspondence created from web UI?
  • Would it be possible to put that same information in the actual
    envelope recipients).

Long story

From my experience with RT, currently when a notification is sent by
RT, there is no way to know for sure whom the message was sent to
(apart from yourself).

It’s true that you can easily put the Ticket fields (Requestor, CCs)
into the templates, but the information about the actual recipients of
the Correspondence is lost. In our way of working with RT, there are
many cases when messages are sent from RT to only a subset of
Requestors, or maybe people in CC replies putting RT address in copy.

We would like to have the actual To: and CC: information included in
AdminCC notifications, so I have been playing with several different
elements in the Template.

If the Correspondence is the result of an incoming e-mail, it’s easy
to extract the information from the To: and CC: headers in the
template ($Transaction->Message->First->GetHeader() or
$Transaction->Message->First->NiceHeaders).

However, I haven’t been able to do the same for correspondence
generated from the web interface, as in that case the Attachment does
not contain any To: or CC: headers. (only one-time recipients in
RT-Send-CC: and RT-Send-Bcc:)

So far I have tried from the Template

  • $Transaction->Recipients unsuccessfully (gives error, can’t call
    method on undefined object).
  • $Transacton->Addresses => looking at the code, it just parses the headers.

I have looked at lib/RT/Ticket/Elements/ShowSimplifiedRecipients but
I’m not sure it’s possible to do the same in a Template.

What would be the simplest way to solve this?

A different but related feature would be for RT to preserve the "To:"
and “Cc:” headers in notifications to AdminCcs. Right now,
SendEmail.pm can introduce a fake “PseudoTo” but it does not give any
useful information.

Currently, RT uses -t to make sendmail set the SMTP envelope
recipients parsing the To,CC and BCC headers included in the message.
Would it be possible to change this behaviour so the recipients of a
mail are specified directly into the sendmail command, instead of
using “-t” for letting the tool parse the message headers? Would it
break any existing functionality?

This way, you could set the headers directly from the Template, and
the notification scrips should decide the recipients by themselves.

Thank you in advance,

Marcos.