[rt-users] Adding comment on "On Create" ?

Jarno Huuskonen jarno.huuskonen at uef.fi
Wed Jan 27 07:56:05 EST 2010


Hi,

I'm trying to modify "On Create Autoreply To Requestors" scrip to
detect invalid email addresses and disable autoreply for those
tickets (we have bunch of web-forms -> buggy addresses).

What I have now is basically something like this (I also check that
the queue is where I want to have autoreply):

if ($self->TransactionObj->Type ne 'Create') {
        return 0;
}

# Extract requestor address
my $requestor = lc($self->TicketObj->RequestorAddresses);

# Empty requestor
if (! defined($requestor)) {
        return 1;
}

my $addrok = 0;
eval {
        use Email::Valid;
        $addrok = Email::Valid->address(
                -address => $requestor,
                -mxcheck => 1,
                -tldcheck => 1,
                -fqdn => 1 );

};
# Eval failed ... what to do ?
if ($@) {
        return 1;
}
if (!$addrok) {
        $RT::Logger->info("No autoreply (invalid address) for ticket #". $self->TicketObj->id ." in queue '".  $self->TicketObj->QueueObj->Name . "'");
        return 0;
}
return 1;

This seems to work OK, but I'd like to know if it's possible to add a
comment ("Possibly invalid email, please check") to the ticket
(and not send an autoreply).

Sorry if this has been answered before, but I haven't found a solution
yet.

-Jarno

-- 
Jarno Huuskonen



More information about the rt-users mailing list