How to prevent email if the ticket creation or update is not from a specific domain?

I’ve been trying to figure out how to send an email to a specific address
if a ticket was created or updated by someone NOT in a company.

I tried to create a custom scrip with condition “User Defined” , action
"Notify Other Recipients", and a custom template, but I couldn’t seem to
get it working right.
Any advice would be appreciated.

Custom scrip:

User defined Condition:

#my $actor = $self->TransactionObj->CreatorObj;
my $actor=$self->TransactionObj->LastUpdatedByObj;

avoid triggering email if the person updating or creating the ticket is

in the company
if ($actor->EmailAddress =~ / {
return 0;
else {
return 1;

Custom action preparation code:
return 1;

Custom action commit code:
return 1;

Custom template:

Testing conditions!