[Rt-devel] Altering a new ticket's subject

Jesse Vincent jesse at bestpractical.com
Mon Mar 23 10:12:06 EDT 2009


Dan,

I'd recommend an RT::Interface::Email::Plugin

You can set the plugins you want in your RT_SiteConfig and the plugins
can massage messages before RT touches them. 

On Fri, Mar 20, 2009 at 04:38:29PM -0400, Dan Thomson wrote:
> Hey all,
> 
> I've been playing with RT recently and I've been charged with making
> small automatic modifications to a ticket's Subject field upon
> reception of an email. I'm trying to do this in the least invasive way
> possible, but I can't figure out how to do this without making
> modifications to the actual RT code base.
> 
> What I'm doing presently is making use of the "Pre" callback in
> mail-gateway to add some tags to the message subject line, then
> returning the modification to $ARGS{'message'}.
> 
> eg.
> 
>        diff -Nur rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway
> rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
>        --- rt-3.6.1/html/REST/1.0/NoAuth/mail-gateway  2009-03-20
> 14:10:23.000000000 -0400
>        +++ rt-3.6.1-subjecttags/html/REST/1.0/NoAuth/mail-gateway
> 2009-03-20 14:10:46.000000000 -0400
>        @@ -52,7 +52,11 @@
>         $ticket => undef
>         </%ARGS>
>         <%init>
>        -$m->comp('/Elements/Callback', _CallbackName => 'Pre', %ARGS);
>        +my %argsTmp = $m->comp('/Elements/Callback', _CallbackName =>
> 'Pre', %ARGS);
>        +if($argsTmp{'message'})
>        +{
>        +   $ARGS{'message'} = $argsTmp{'message'};
>        +}
>         use RT::Interface::Email ();    # It's an exporter, but we don't care
>         $r->content_type('text/plain; charset=utf-8');
>         $m->error_format('text');
> 
> 
> There's gotta be a better way, but I don't know the code well enough
> myself. Can anybody point me in the right direction here? I'm
> presently using version 3.6.1 (I know, I know, I know :)). Any help
> would be appreciated.
> 
> Thanks,
> 
> -- 
> Dan Thomson
> _______________________________________________
> List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
> 

-- 


More information about the Rt-devel mailing list