Accessing the original "To:" recipient field

Hello list,

I’m trying to find how to retrieve -in a scrip- the original “To:” from
a mail submitted ticket.

Details :
I have a single entry queue (called “support”), with multiple email aliases.
The main adress of that queue is support@example.com

In my postfix configuration, I created some aliases, like :
application1@example.com ==> support@example.com
application2@example.com ==> support@example.com

Emails arrive correctly into the support queue, and in the first ticket
history entry, I do have the “To: application1@example.com”, which is
good for me.

I would like to access this information (application1@example.com here)
in a scrip, in order to correctly set a custom field.

It is maybe obvious, but I can’t find how to do this.

Anyone?

Raphael Berlamont.

Try something like this:

my $Transaction = $self->TransactionObj;
my $header = $Transaction->Attachments->First->GetHeader(‘To’);
my @addr = Mail::Address->parse($header);
foreach my $addrobj (@addr) {
my $addr = lc $RT::Nobody->UserObj->CanonicalizeEmailAddress($addrobj->address);

$addr should now be set to: application1@example.com

}

~JasonOn Thu, 2008-01-03 at 16:48 +0100, Raphux wrote:

Hello list,

I’m trying to find how to retrieve -in a scrip- the original “To:” from
a mail submitted ticket.

Details :
I have a single entry queue (called “support”), with multiple email aliases.
The main adress of that queue is support@example.com

In my postfix configuration, I created some aliases, like :
application1@example.com ==> support@example.com
application2@example.com ==> support@example.com

Emails arrive correctly into the support queue, and in the first ticket
history entry, I do have the “To: application1@example.com”, which is
good for me.

I would like to access this information (application1@example.com here)
in a scrip, in order to correctly set a custom field.

It is maybe obvious, but I can’t find how to do this.

Anyone?

/------------------------------------------------------------------
| Jason A. Smith Email: smithj4@bnl.gov |
| Atlas Computing Facility, Bldg. 510M Phone: +1-631-344-4226 |
| Brookhaven National Lab, P.O. Box 5000 Fax: +1-631-344-7616 |
| Upton, NY 11973-5000, U.S.A. |
------------------------------------------------------------------/

Jason A. Smith a �crit :

Try something like this:

my $Transaction = $self->TransactionObj;
my $header = $Transaction->Attachments->First->GetHeader(‘To’);
my @addr = Mail::Address->parse($header);
foreach my $addrobj (@addr) {
my $addr = lc $RT::Nobody->UserObj->CanonicalizeEmailAddress($addrobj->address);

$addr should now be set to: application1@example.com

}

This worked.

I though it would be reachable with an RT object, but I guess that will do.

Thank you!

Regards,

Raphael Berlamont.