Commands by Email

Way back in the day, when I was heavily involved in the development of
RT, there was a way to send commands in to RT to set some of the
metadata (queue, owner, status, etc).

Now that the place I am at is heavily entrenched in to RT 3.8.4 and our
separate front-end form submission system is nearing completion (it’s on
an ASP server… not by my choice, but it is what it is…), I’m looking
in to how to get the latest RT to do the same. I installed the
CommandsByMail extension, and it is parsing the email, but it isn’t
parsing everything. In fact, it is only processing the Owner setting.

I get the feeling like I am missing syntax, ordering, or something, but
I am not getting a lot (any) of debugging out of it. Additionally, the
documentation is relatively slim.

Any pointers in the right direction are more than welcome. :slight_smile:

Thanks!
-Rich

What’s so slim in the doc?

http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Extension/CommandByMail.pm
http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Interface/Email/Filter/TakeAction.pm#COMMANDS_commands_below

Simple rules: no html, no empty lines, commands like headers, but in body.On Wed, Jul 22, 2009 at 11:14 PM, Rich WestRich.West@wesmo.com wrote:

Way back in the day, when I was heavily involved in the development of
RT, there was a way to send commands in to RT to set some of the
metadata (queue, owner, status, etc).

Now that the place I am at is heavily entrenched in to RT 3.8.4 and our
separate front-end form submission system is nearing completion (it’s on
an ASP server… not by my choice, but it is what it is…), I’m looking
in to how to get the latest RT to do the same. I installed the
CommandsByMail extension, and it is parsing the email, but it isn’t
parsing everything. In fact, it is only processing the Owner setting.

I get the feeling like I am missing syntax, ordering, or something, but
I am not getting a lot (any) of debugging out of it. Additionally, the
documentation is relatively slim.

Any pointers in the right direction are more than welcome. :slight_smile:

Thanks!
-Rich


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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

Best regards, Ruslan.

I also would be interested in knowing what the current state of this is as I want to use th systrm in an entire email read remote fashion------Original Message------
From: Rich West Rich.West@wesmo.com
To: "rt-users@lists.bestpractical.com" rt-users@lists.bestpractical.com
Date: Wed, 22 Jul 2009 03:14:49 PM -0400
Subject: [rt-users] Commands by Email

Way back in the day, when I was heavily involved in the development of
RT, there was a way to send commands in to RT to set some of the
metadata (queue, owner, status, etc).

Now that the place I am at is heavily entrenched in to RT 3.8.4 and our
separate front-end form submission system is nearing completion (it’s on
an ASP server… not by my choice, but it is what it is…), I’m looking
in to how to get the latest RT to do the same. I installed the
CommandsByMail extension, and it is parsing the email, but it isn’t
parsing everything. In fact, it is only processing the Owner setting.

I get the feeling like I am missing syntax, ordering, or something, but
I am not getting a lot (any) of debugging out of it. Additionally, the
documentation is relatively slim.

Any pointers in the right direction are more than welcome. :slight_smile:

Thanks!
-Rich
http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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

The extension works rather well once you get past the caveats of the
formatting. With regard to the slimness of the documentation, it
doesn’t mention those ‘simple rules’, which forced me to comb through
the code (which is rather clean) to determine the proper formatting
which led to the discovery that outlook has a tendency to insert blank
lines when the MIME conversion happens.

Also, the section describing how it applies to custom fields is fairly
vague. Are the curly braces required (is that what is meant by “The
curly braces are literal”) for custom field declaration? Would a
correct example be “CustomField.{Severity}: Severity 2 - Multiple Users
Down”? Does “AddCustomField” set the custom field, or would that be
"CustomField"? What, if any, is the difference between AddCustomField
and CustomField?

Specifically, I have been unable to get custom fields to be applied when
testing this extension. Everything else worked once I realized that my
mail program was getting blank lines inserted. :frowning:

-RichOn 07/22/2009 04:53 PM, Ruslan Zakirov wrote:

What’s so slim in the doc?

http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Extension/CommandByMail.pm
http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Interface/Email/Filter/TakeAction.pm#COMMANDS_commands_below

Simple rules: no html, no empty lines, commands like headers, but in body.

On Wed, Jul 22, 2009 at 11:14 PM, Rich WestRich.West@wesmo.com wrote:

Way back in the day, when I was heavily involved in the development of
RT, there was a way to send commands in to RT to set some of the
metadata (queue, owner, status, etc).

Now that the place I am at is heavily entrenched in to RT 3.8.4 and our
separate front-end form submission system is nearing completion (it’s on
an ASP server… not by my choice, but it is what it is…), I’m looking
in to how to get the latest RT to do the same. I installed the
CommandsByMail extension, and it is parsing the email, but it isn’t
parsing everything. In fact, it is only processing the Owner setting.

I get the feeling like I am missing syntax, ordering, or something, but
I am not getting a lot (any) of debugging out of it. Additionally, the
documentation is relatively slim.

Any pointers in the right direction are more than welcome. :slight_smile:

Thanks!
-Rich


http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users

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

Another question, though… is there a way to strip out the email
commands from the content of the ticket as it shows up in Request Tracker?

-RichOn 07/23/2009 10:56 AM, Rich West wrote:

The extension works rather well once you get past the caveats of the
formatting. With regard to the slimness of the documentation, it
doesn’t mention those ‘simple rules’, which forced me to comb through
the code (which is rather clean) to determine the proper formatting
which led to the discovery that outlook has a tendency to insert blank
lines when the MIME conversion happens.

Also, the section describing how it applies to custom fields is fairly
vague. Are the curly braces required (is that what is meant by “The
curly braces are literal”) for custom field declaration? Would a
correct example be “CustomField.{Severity}: Severity 2 - Multiple
Users Down”? Does “AddCustomField” set the custom field, or would
that be “CustomField”? What, if any, is the difference between
AddCustomField and CustomField?

Specifically, I have been unable to get custom fields to be applied
when testing this extension. Everything else worked once I realized
that my mail program was getting blank lines inserted. :frowning:

-Rich

On 07/22/2009 04:53 PM, Ruslan Zakirov wrote:

What’s so slim in the doc?

http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Extension/CommandByMail.pm
http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Interface/Email/Filter/TakeAction.pm#COMMANDS_commands_below

Simple rules: no html, no empty lines, commands like headers, but in body.

On Wed, Jul 22, 2009 at 11:14 PM, Rich WestRich.West@wesmo.com wrote:

Way back in the day, when I was heavily involved in the development of
RT, there was a way to send commands in to RT to set some of the
metadata (queue, owner, status, etc).

Now that the place I am at is heavily entrenched in to RT 3.8.4 and our
separate front-end form submission system is nearing completion (it’s on
an ASP server… not by my choice, but it is what it is…), I’m looking
in to how to get the latest RT to do the same. I installed the
CommandsByMail extension, and it is parsing the email, but it isn’t
parsing everything. In fact, it is only processing the Owner setting.

I get the feeling like I am missing syntax, ordering, or something, but
I am not getting a lot (any) of debugging out of it. Additionally, the
documentation is relatively slim.

Any pointers in the right direction are more than welcome. :slight_smile:

Thanks!
-Rich

One item that should be documented is that this extension cannot handle
spaces in the custom field names. Spaces causes it to break. :frowning:

-RichOn 07/23/2009 10:56 AM, Rich West wrote:

The extension works rather well once you get past the caveats of the
formatting. With regard to the slimness of the documentation, it
doesn’t mention those ‘simple rules’, which forced me to comb through
the code (which is rather clean) to determine the proper formatting
which led to the discovery that outlook has a tendency to insert blank
lines when the MIME conversion happens.

Also, the section describing how it applies to custom fields is fairly
vague. Are the curly braces required (is that what is meant by “The
curly braces are literal”) for custom field declaration? Would a
correct example be “CustomField.{Severity}: Severity 2 - Multiple
Users Down”? Does “AddCustomField” set the custom field, or would
that be “CustomField”? What, if any, is the difference between
AddCustomField and CustomField?

Specifically, I have been unable to get custom fields to be applied
when testing this extension. Everything else worked once I realized
that my mail program was getting blank lines inserted. :frowning:

-Rich

On 07/22/2009 04:53 PM, Ruslan Zakirov wrote:

What’s so slim in the doc?

http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Extension/CommandByMail.pm
http://search.cpan.org/~falcone/RT-Extension-CommandByMail-0.07/lib/RT/Interface/Email/Filter/TakeAction.pm#COMMANDS_commands_below

Simple rules: no html, no empty lines, commands like headers, but in body.

On Wed, Jul 22, 2009 at 11:14 PM, Rich WestRich.West@wesmo.com wrote:

Way back in the day, when I was heavily involved in the development of
RT, there was a way to send commands in to RT to set some of the
metadata (queue, owner, status, etc).

Now that the place I am at is heavily entrenched in to RT 3.8.4 and our
separate front-end form submission system is nearing completion (it’s on
an ASP server… not by my choice, but it is what it is…), I’m looking
in to how to get the latest RT to do the same. I installed the
CommandsByMail extension, and it is parsing the email, but it isn’t
parsing everything. In fact, it is only processing the Owner setting.

I get the feeling like I am missing syntax, ordering, or something, but
I am not getting a lot (any) of debugging out of it. Additionally, the
documentation is relatively slim.

Any pointers in the right direction are more than welcome. :slight_smile:

Thanks!
-Rich

To remove the commands I added a few lines
to /opt/rt3/local/lib/RT/Transaction_Overlay.pm

     # Remove quoted signature.
     $content =~ s/\n-- \n(.*?)$//s;
  •    # Remove CommandByMail commands
    
  •    my @content     = split ("\n",$content);
    
  •    my @new_content = ();
    
  •    foreach ( @content ) {
    
  •        if ( ( $_ =~ /^Requestor:/ ) or
    
  •            ( $_ =~ /^CF.{Foo}:/ ) or
    
  •            ( $_ =~ /^CF.{WhatElse}:/ ) ) {
    
  •            next;
    
  •        }
    
  •        push ( @new_content, $_);
    
  •    }
    
  •    $content = join("\n",@new_content);
       # What's the longest line like?
       my $max = 0;
    
  • Andreas

Being unfamiliar with how to drop things in the local/lib tree, is the
process to simply create a file of the same name and the contents are
added? or does the file entirely replace the original?

-RichOn 08/03/2009 10:20 AM, Andreas Ittgenshorst wrote:

To remove the commands I added a few lines
to /opt/rt3/local/lib/RT/Transaction_Overlay.pm

     # Remove quoted signature.
     $content =~ s/\n-- \n(.*?)$//s;
  •    # Remove CommandByMail commands
    
  •    my @content     = split ("\n",$content);
    
  •    my @new_content = ();
    
  •    foreach ( @content ) {
    
  •        if ( ( $_ =~ /^Requestor:/ ) or
    
  •            ( $_ =~ /^CF.{Foo}:/ ) or
    
  •            ( $_ =~ /^CF.{WhatElse}:/ ) ) {
    
  •            next;
    
  •        }
    
  •        push ( @new_content, $_);
    
  •    }
    
  •    $content = join("\n",@new_content);
    
  •    # What's the longest line like?
       my $max = 0;
    
  • Andreas

Another question, though… is there a way to strip out the email
commands from the content of the ticket as it shows up in Request
Tracker?

Being unfamiliar with how to drop things in the local/lib tree, is the
process to simply create a file of the same name and the contents are
added? or does the file entirely replace the original?
Local overrides original. Appending would raise all sorts of problems
(redefining subroutines, etc.)

Cambridge Energy Alliance: Save money. Save the planet.

Argh… I have the code in place (actually, improved upon the code by
replicating some of the detection code from the original plugin), and I
can see it is working via some test code, but the commands still show up
in the content of the ticket.

So… that leads to the question: where did you put your code in to the
Transaction_Overlay.pm file in order to get it to work? :slight_smile:

I had appended it to the end of the “Content” subroutine, and I can see
from the output I have going to /tmp/content.txt that the content is
getting modified appropriately:

more /tmp/content.txt

omitting Owner: rwest
omitting Status: open
omitting CF.{CVendors}: IBM
omitting
This is a test

But when I look at the web GUI, I still see the commands:

Subject: Test
To: support-dev@ourdomain.net
Date: Fri, 7 Aug 2009 11:44:15 -0400
From: root@helpdesk-dev.ourdomain.net
Download (untitled) / with headers
text/plain 71b
Owner: rwest
Status: open
CF.{CVendors}: IBM

This is a test


Rich

I just have this feeling like I have placed it in the wrong location in
the code… :frowning:

Thanks!
-Rich

    $content = $self->loc("On [_1], [_2] wrote:",

$self->CreatedAsString, $self->CreatorObj->Name)
. “\n$content\n\n”;
}

open (TEST, “> /tmp/content.txt”);

Remove quoted signature.

$content =~ s/\n–\n(.*?)$//s;

Remove CommandByMail commands

my @content = split ("\n",$content);
my @new_content = ();
my $no_pseudoheaders = 0;
my $line = “”;
foreach $line ( @content )
{
if ($line =~ /^(?:(\S+)\s*?:\s*?(.)\s?|)$/)
{
print TEST “omitting $line\n”;
}
next if ($line =~ /^(?:(\S+)\s*?:\s*?(.)\s?|)$/);
print TEST “$line\n”;
push ( @new_content, $line);
}
$content = join("\n",@new_content);
print $content;
close (TEST);

return ($content);

}

}}}

=head2 AddressesOn 08/03/2009 10:20 AM, Andreas Ittgenshorst wrote:

To remove the commands I added a few lines
to /opt/rt3/local/lib/RT/Transaction_Overlay.pm

     # Remove quoted signature.
     $content =~ s/\n-- \n(.*?)$//s;
  •    # Remove CommandByMail commands
    
  •    my @content     = split ("\n",$content);
    
  •    my @new_content = ();
    
  •    foreach ( @content ) {
    
  •        if ( ( $_ =~ /^Requestor:/ ) or
    
  •            ( $_ =~ /^CF.{Foo}:/ ) or
    
  •            ( $_ =~ /^CF.{WhatElse}:/ ) ) {
    
  •            next;
    
  •        }
    
  •        push ( @new_content, $_);
    
  •    }
    
  •    $content = join("\n",@new_content);
    
  •    # What's the longest line like?
       my $max = 0;
    
  • Andreas

Another question, though… is there a way to strip out the email
commands from the content of the ticket as it shows up in Request
Tracker?