Filling Custom Fields from E-mail

Anyone got scripts that can fill in custom fields from an email. I know
the enhanced mailgate does this for 2.0 but does anyone have anything
like this for 3.0. Even if it’s just some shell code or a work in
progress I would be intrested in seeing it.

Thanks
Jason

Hello,

We have setup RT3 with a few custom fields. I would like to fill some of
those fields from
the E-mails that we are injecting into the system. What would be the best
way to do this.

Thanks
Jason

Jason Alexander
Senior Security Analyst
CIO Office, The University of Iowa
300-28 University Services Building
jason-alexander@uiowa.edu / 319-335-6174

Hello Jason,

–Am Montag, 2. Juni 2003 11:48 Uhr -0500 schrieb Jason Alexander
jason-alexander@uiowa.edu:

We have setup RT3 with a few custom fields. I would like to fill some of
those fields from the E-mails that we are injecting into the system.
What would be the best way to do this.

I have set up a scrip with the following settings as a proof of concept
(Please see the explanation below!). I will develop this further soon:

On Create

Custom Action prepare:
return(1);

Custom Action cleanup:
my $Ticket = $self->TicketObj;
my $Transaction = $self->TransactionObj;
my $mailer = $Transaction->Attachments->First->GetHeader(‘X-Mailer’);
my $cf = new RT::CustomField($RT::SystemUser);
my $id;
my $msg;

#$RT::Logger->debug(“load cf mailer”);
($id,$msg) = $cf->LoadByNameAndQueue (Name=>‘mailer’, Queue=>0);
#$RT::Logger->debug(“load cf done: $id $msg”);

$RT::Logger->debug(“add cf mailer ($mailer)”);
($id,$msg) = $Ticket->AddCustomFieldValue (Field => $cf, Value => $mailer);
$RT::Logger->debug(“add cf done: $id $msg”);

return(1);

You can strip the debug code from the code.

Explanation:

I decided to use headers of the email to transport structured data. We will
later provide a Webform to compose a email and send it to a RT-System. All
structured data will be coded in X-Headers and unstructured data goes into
the mail body.
So the given scrip extracts the value of the “X-Mailer”-Header into a
custom field which must exists globally. Any other header will be good,
too. You can even modify it, by grabbing keywords out of the body.

In future I will make this cistomizable by a template, which consists of
triples:
(HeaderFieldName, TargetCustomFieldName, substitution code), where the
substitution code is basicly a s/// command, which converts the found
header value to the customFieldValue.

Dirk.