[rt-users] Scrip to add watchers from mail body
Johan Baarman
johan.baarman at citec.fi
Mon May 12 03:11:35 EDT 2008
Hi list,
I¹m trying to create a scip that will add several watchers from a mail body
on ticket creation. It works alright for the first line but can¹t get it to
add several watchers. I¹ve followed
http://wiki.bestpractical.com/view/SetTicketPropertiesViaMail but I¹m not
too confident with perl to get it work.
My message body looks like this:
Set-CC:john.doe at mycompany.com
Set-CC:marcus.whatever at mycompany.com
Set-CC:brian.surname at mycompany.com
And my scrip looks like:
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-CC:\E\s*(\S+)\s*$/m ) {
$self->TicketObj->AddWatcher( Type => "Cc", Email => $1);
}
# strip special commands from email content
$content =~ s/^\QSet-CC:\E\s*(\S+)\s*$//gm;
# silently overwrite attachment content
$AttachObj->__Set( Field => 'Content', Value => $content );
1;
I guess I should make the scrip go through each line but don¹t know how?
Thank in advance
Johan
###########################################
This message has been scanned by F-Secure Anti-Virus for Microsoft Exchange.
For more information, connect to http://www.f-secure.com/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20080512/c786a44a/attachment.htm>
More information about the rt-users
mailing list