SendEmailAction
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} ------------- {$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} ------------- {$Transaction->Content()}
Small problem with v3.8.4 and empty ticket body
SendEmail fails with Request Tracker v3.8.4 if the body of the request is empty. For example if using the rt shell to create a ticket (useful for testing) like so:
rt create -t ticket set subject='TEST - please ignore' queue='Testing' requestor='address@thing.com'
Then the ticket has no content and there is an error message (Ubuntu Karmic puts this is in /var/log/syslog) like:
RT: error: unexpected end of header (/usr/share/request-tracker3.8/lib/RT/Template_Overlay.pm:356)