Filter on body

Hi list,

I need to create a filter to move messages to a queue automaticly depending on
the contents of the email body. I already have filters checking on subject so
I think I can reuse that one.

Would the following filter work?

Condition: On Create

Action: User Defined

Template: Global template: Blank

Stage: TransactionCreate

Custom condition:

Custom action preparation code: return 1;

Custom action cleanup code:
if ($self->TicketObj->Body( ) =~ /Content I filter on /i ) {

$self->TicketObj->SetQueue(‘Destination queue’);
return 1;
}

Thanks for any help on this in advance.

Best regards,

Machiel van Veen

On IRC someone suggested,
if ($self->$TicketObj->Transactions->First->Content =~ /Zylab body filter
test /i )

It does not work though, does anyone know how I can refine this?

If any one can point me to the right docs that would be great too, I tried the
wiki but it seems to be incomplete. I attempted the read from the code but
thats way over my head.

Thanks again for any replies on this.

Best regards

Machiel van VeenOn Tuesday 11 September 2007 10:46, Machiel van Veen wrote:

Hi list,

I need to create a filter to move messages to a queue automaticly depending
on the contents of the email body. I already have filters checking on
subject so I think I can reuse that one.

Would the following filter work?


Condition: On Create

Action: User Defined

Template: Global template: Blank

Stage: TransactionCreate

Custom condition:

Custom action preparation code: return 1;

Custom action cleanup code:
if ($self->TicketObj->Body( ) =~ /Content I filter on /i ) {

$self->TicketObj->SetQueue(‘Destination queue’);
return 1;
}


Thanks for any help on this in advance.

Hi,

We use RT to recive generated email from automated systems. The user in this
case is on the RT side of things handeling the tickets.

I could of course have the automated systems send their mail to a specific
address but that would make things a lot harder to administer. And if I can
filter on the Subject, it must be possible to filter on the contents of the
message too(?).

Best regards,

Machiel van VeenOn Tuesday 11 September 2007 17:30, Patterson, Craig wrote:

Not to change directions on you, but you could set up an email address
for each of your queues, then use rt-mailgate and /etc/aliases to create
tickets from those emails in the appropriate appropriate queues. There
are directions on how to do this in the rt_essentials book, the mailing
list, the readme, and the wiki

It seems to me that in order to successfully filter the emails, you
would have to train your users to put keywords in the email body. It
would probably be a lot easier to just train them to send their requests
to the appropriate email address, ie networkqueue@helpdesk.com, etc.

Not to change directions on you, but you could set up an email address
for each of your queues, then use rt-mailgate and /etc/aliases to create
tickets from those emails in the appropriate appropriate queues. There
are directions on how to do this in the rt_essentials book, the mailing
list, the readme, and the wiki

It seems to me that in order to successfully filter the emails, you
would have to train your users to put keywords in the email body. It
would probably be a lot easier to just train them to send their requests
to the appropriate email address, ie networkqueue@helpdesk.com, etc.From: rt-users-bounces@lists.bestpractical.com
[mailto:rt-users-bounces@lists.bestpractical.com] On Behalf Of Machiel
van Veen
Sent: Tuesday, September 11, 2007 11:16 AM
To: rt-users@lists.bestpractical.com
Subject: Re: [rt-users] Filter on body

On IRC someone suggested,
if ($self->$TicketObj->Transactions->First->Content =~ /Zylab body
filter
test /i )

It does not work though, does anyone know how I can refine this?

If any one can point me to the right docs that would be great too, I
tried the
wiki but it seems to be incomplete. I attempted the read from the code
but
thats way over my head.

Thanks again for any replies on this.

Best regards

Machiel van Veen

Hi list,

I need to create a filter to move messages to a queue automaticly
depending
on the contents of the email body. I already have filters checking on
subject so I think I can reuse that one.

Would the following filter work?


Condition: On Create

Action: User Defined

Template: Global template: Blank

Stage: TransactionCreate

Custom condition:

Custom action preparation code: return 1;

Custom action cleanup code:
if ($self->TicketObj->Body( ) =~ /Content I filter on /i ) {

$self->TicketObj->SetQueue(‘Destination queue’);
return 1;
}


Thanks for any help on this in advance.
The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Maybe you could look at having procmail handle the rt-mailgate with appropriate parameters…

Procmail would have the ability to filter on any part of the message (any header or body). If you are running this on a *nix, it should be fairly straight forward…

Jok

Hi Machiel,

I do something similar. Since this transaction is On Create, look at the
transaction content instead of the ticket body.
if ($self->TransactionObj->Content( ) =~ /Content I filter on /i )

Regards,
Gene

At 01:46 AM 9/11/2007, Machiel van Veen wrote:

Hi list,

I need to create a filter to move messages to a queue automaticly
depending on
the contents of the email body. I already have filters checking on subject so
I think I can reuse that one.

Would the following filter work?


Condition: On Create

Action: User Defined

Template: Global template: Blank

Stage: TransactionCreate

Custom condition:

Custom action preparation code: return 1;

Custom action cleanup code:
if ($self->TicketObj->Body( ) =~ /Content I filter on /i ) {

$self->TicketObj->SetQueue(‘Destination queue’);
return 1;
}


Thanks for any help on this in advance.


Best regards,

Machiel van Veen


The rt-users Archives

Community help: http://wiki.bestpractical.com
Commercial support: sales@bestpractical.com

Discover RT’s hidden secrets with RT Essentials from O’Reilly Media.
Buy a copy at http://rtbook.bestpractical.com

Gene LeDuc, GSEC
Security Analyst
San Diego State University

Great, that did the trick.

Thanks a million for the code.

Best regards,

Machiel van VeenOn Tuesday 11 September 2007 18:53, Gene LeDuc wrote:

Hi Machiel,

I do something similar. Since this transaction is On Create, look at the
transaction content instead of the ticket body.
if ($self->TransactionObj->Content( ) =~ /Content I filter on /i )

Regards,
Gene