
thomson.dan at gmail
Mar 23, 2009, 9:05 AM
Post #4 of 9
(1540 views)
Permalink
|
It turns out that doesn't solve my problem. Since I'm changing the subject line, I need a modified subject value, but the subject is parsed out of the message before it ever hits the plugins. Basically, I need to modify $Message->head->get("Subject") (in RT::Interface::Email::Gateway) but there's no way to do that from a mail plugin. 2009/3/23 Dan Thomson <thomson.dan [at] gmail>: > Ah! Can't believe I missed that RawMessageRef argument. This is > exactly what I need. > > Thanks! > > 2009/3/23 Jesse Vincent <jesse [at] bestpractical>: >> >> 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 >>> >> >> -- >> > > > > -- > Dan Thomson > -- Dan Thomson _______________________________________________ List info: http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-devel
|