[rt-users] Scrip send email on create
Dan O'Neill
rt at northpb.com
Mon Feb 2 19:05:57 EST 2009
Enclosed is a script that adds one or more AdminCC's to a ticket during
Create. This does not cause the AdminCC's to receive an email.
How do I modify this Scrip or otherwise configure the Queue such that
AdminCC's will receive a copy of the text in the opening transaction?
Here is the scrip information. I've reviewed the contributions page and
read what I can before asking this question. Thanks for the help.
Condition: On Create
Action: User Defined
Template: Global template: Blank
Stage: Transaction Create
Custom condition: <empty>
Custom action preparation code: return 1;
Custom action cleanup code:
my $owner_id = $self->TicketObj->Owner;
my $requestor_email = $self->TicketObj->RequestorAddresses;
my $admincclist = $self->TicketObj->AdminCc;
my @actors = ('fred at company.com', 'wilma at company.com');
my $user = RT::User->new($RT::SystemUser);
if ( $self->TicketObj->Subject =~ m/Customer A/i ) {
foreach my $actor (@actors) {
$user->LoadByEmail($actor);
my $user_id = $user->Id;
my $user_email = $user->EmailAddress;
if ( $user_email ne $requestor_email )
{
my($status, $msg) = $admincclist->AddMember($user->Id);
unless( $status ) {
$RT::Logger->warning( "can't add ticket owner as Cc : msg" );
return undef;
}
}
}
} else {
return 0;
}
More information about the rt-users
mailing list