[Rt-devel] Help: Scrip to send emails to an address if CF.{distro} = 'public'

Riccardo Carlesso riccardo.carlesso at heanet.ie
Wed Jan 19 07:28:54 EST 2011

we need to implement a functionality that allows to send a FooTemplate
to a well-known email address ('public.foo at example.com') on every
Open/Reply/Close of a ticket if a 'distribution' CustomField is set to

I implemented the ScripCondition in the
local/RT/Condition/OnHeanetPublicTicket.pm (see below for the code: Im
still missing the part that checks for open/reply/close and ignores

The tricky part comes now.

I dont seem to be able to implement a ScripAction to send an
'additional' email to 'public.foo at example.com'. A lot of SendMail magic
is in RT, according to the logs. For instance, it checks for
Tos/Ccs/Bccs from many parts and depending on this it sends (or not) an

I see there's a ScripAction called SendEmail. Can I create a
HeanetSendPublicEmail action the calls the 'SendEmail' action with ONLY
my custom 'To' field and ignoring other Ccs and Bccs? Or maybe use a
Notify action with SetRecipients? Can anyone point me to some URL
resource for implementing an Action myself?

If this CF need was a Queue by itself (but we want this behaviour to be
trasversal to ALL queues..), it would be easy by putting that email in
Cc/AdminCc, I assume.

Thanks a lot,

----- code for ScripCondition on
'local/RT/Condition/OnHeanetPublicTicket.pm' --------
sub isApplicable {
	my $self = shift;

	my $Ticket = $self->TicketObj;
	my $distro = $Ticket->FirstCustomFieldValue('Distribution');
	my $ret = ($Ticket->FirstCustomFieldValue('Distribution') eq 'public') ;
	my $subject = $Ticket->Subject();
	return $ret ;

Riccardo Carlesso

HEAnet Limited, Ireland's Education and Research Network
 1st Floor, 5 George's Dock, IFSC, Dublin 1
  Registered in Ireland, no 275301
Tel: +353-1-660 9040        Fax: +353-1-660 3666
Web: http://www.heanet.ie/  PGP: 4096R/772F54DE

More information about the rt-devel mailing list