[rt-users] Accessing the original "To:" recipient field

Jason A. Smith smithj4 at bnl.gov
Thu Jan 3 11:30:40 EST 2008


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 at example.com
}

~Jason


On 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 at example.com
> 
> In my postfix configuration, I created some aliases, like :
> application1 at example.com ==> support at example.com
> application2 at example.com ==> support at example.com
> 
> Emails arrive correctly into the support queue, and in the first ticket 
> history entry, I do have the "To: application1 at example.com", which is 
> good for me.
> 
> I would like to access this information (application1 at 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 at 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.                                   |
\------------------------------------------------------------------/





More information about the rt-users mailing list