Send mail with scrip

I’m trying to write a scrip that sends an email but only if the owner of the ticket is a certain group, but I keep getting an error.

my $Ticket = $self->TicketObj;

$RT::Logger->info( 'Sending email' );
$RT::Logger->info($Ticket->RequestorAddresses);

my $args = {
    Template => 'Correspondence',
    Arguments => {},
    To => $Ticket->RequestorAddresses,
    Cc => undef,
    Bcc => undef,
    From => RT->Config->Get('CorrespondAddress'),
    InReplyTo => undef,
    ExtraHeaders => {}
};

my $result = RT::Interface::Email->SendEmailUsingTemplate( Template => 'Correspondence' );

$RT::Logger->info( $result );

return 1;

This is what it returns: RT: [130904] Couldn’t load template ‘’

I think you should use the “Notify Requestors” action and a scrip with a custom condition that checks if the owner is in your group instead of trying to manually send an email

Yea I was thinking the same, but I wasn’t sure how to check for on correspond

You can check the type of the transaction return unless $self->TransactionObj->Type eq 'Correspond';

1 Like

Okay I’ll try that thanks so much