SendEmailAction

From Request Tracker Wiki
Revision as of 08:40, 27 October 2009 by OliverKuhn (talk)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

The following is built into 3.8.X

This action handles the case where you want to send an email to a certain person, but not require that person to be on the ticket. E.g. whenever a ticket is created, you want to send an email to a certain group of people, but not add that group to the ticket.

This action does not require any Perl code, just a database edit. It uses code already in RT.

Create the following file, named SendEmailAction.install:

# Used to install a scrip action. # # To install, # execute # /path/to/rt3/sbin/rt-setup-database --action insert \ # --datafile /path/to/SendEmailAction.install # @ScripActions = ( { Name => 'Send Email', Description => 'Sends a message to those specified in the template', ExecModule => 'SendEmail', Argument => '' }, );

As the comments in the file indicate, you "install" this file using the '''rt-setup-database''' utility.

rt-setup-database --action insert --datafile SendEmailAction.install

Now when you create a scrip, you should have a new action available to you. To use it, first create a template which determines the content of the message you are sending, as well as the person or persons that will be getting this message.

Here is an example of a template you could use:

To: user1@example.org, user2@example.org Bcc: user3@example.org Subject: {$Ticket->Subject} A ticket has been created in this queue. {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} <hr /> {$Transaction->Content()}

Now, create a scrip. Set the condition to "on create", the action to "send email", and specify your newly created template.

If your scrip was queue-specific, you may also want to create a scrip handling tickets getting assigned to the queue.

To use this action to send email to the members of an RT Group, use a template like this:

To: { my $GroupObj = RT::Group->new($RT::SystemUser); $GroupObj->LoadUserDefinedGroup('Group Name'); $GroupObj->MemberEmailAddressesAsString()} Subject: {$Ticket->Subject} A ticket has been created in this queue. {$RT::WebURL}Ticket/Display.html?id={$Ticket->id} <hr /> {$Transaction->Content()}