[rt-users] changing status/owner via email pt2

Ruslan U. Zakirov Ruslan.Zakirov at acronis.com
Fri Jan 21 08:40:35 EST 2005


Elaine, yeah, that should be fixed, use next code:

my $AttachObj = $self->TransactionObj->Attachments->First;
# go out if content is not text!
unless( $AttachObj->ContentType =~ /^text/ ) {
	return 1;
}

my $content = $AttachObj->Content;
if( $content =~ m/^\QSet-Owner:\E\s*(\S+)\s*$/m ) {
         $self->TicketObj->SetOwner( $1 );
}
if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m ) {
         $self->TicketObj->SetStatus( $1 );
}

# strip special commands from email content
$content =~ s/^\QSet-Status:\E\s*(\S+)\s*$//gm;
$content =~ s/^\QSet-Owner:\E\s*(\S+)\s*$//gm;

# silently overwrite attachment content
$AttachObj->__Set( Field => 'Content', Value => $content );

1;

This code is not tested but should work. If not then post data from logs 
to the list.
And please write instructions how to set up this code on the wiki:
http://wiki.bestpractical.com/index.cgi?SetTicketPropertiesViaMail
I've created link on this page from 
http://wiki.bestpractical.com/index.cgi?Contributions

This scrip has drawbacks that are not addressed yet. For example all 
transactions this scrip creates comes from RT System user not user who 
sent email. This is bad and should be fixed because allow anybody who 
has right create/reply/comment on ticket to set status and owner.

				Best regards. Ruslan.

Elaine . wrote:
> hi
> I got some help the other week from Ruslan and wanted
> to ask a quick query. It was regarding changing
> status/owner via email.
> 
> Code is at the bottom of the email and works fine. My
> query is that with the scrips set up it goes out to
> the user as its seen the same as a normal reply email
> on how to fix the problem. I'd rather if possible not
> email out Set-Status etc . Is there a way ?
> Thanks for any pointers.
> Elaine
> 
> Try next commit code:
> my $content =
> $self->TransactionObj->Attachments->First->Content;
> if( $content =~ m/^\QSet-Owner:\E\s*(\S+)\s*$/m ) {
> 
>         $self->TicketObj->SetOwner( $1 );
> }
> if( $content =~ m/^\QSet-Status:\E\s*(\S+)\s*$/m ) {
> 
>         $self->TicketObj->SetStatus( $1 );
> }
> 1;
> 
> And put into mail body next line:
> ---------------------------------
> Set-Status: rejected
> ---------------------------------
> Don't add empty spaces before Set-Status
> 
> 
> 	
> 	
> 		
> ___________________________________________________________ 
> ALL-NEW Yahoo! Messenger - all new features - even more fun! http://uk.messenger.yahoo.com
> _______________________________________________
> http://lists.bestpractical.com/cgi-bin/mailman/listinfo/rt-users
> 
> RT Administrator and Developer training is coming to your town soon! (Boston, San Francisco, Austin, Sydney) Contact training at bestpractical.com for details.
> 
> Be sure to check out the RT Wiki at http://wiki.bestpractical.com




More information about the rt-users mailing list