[rt-users] Scrip does not send email

Guadagnino Cristiano guadagnino.cristiano at creval.it
Thu Jun 11 04:44:44 EDT 2009


Hi all,
I am having a problem with a scrip that does not send emails as expected.

I have a queue with a mandatory custom field. If a user tries to create a ticket in that queue from the RT interface without populating the cf, RT will complain. However, if a user creates the ticket by sending an email RT will happily create it.

So I created a scrip on that queue that checks if a mandatory cf is present, and if it is - and it is not populated - it will put the ticket in status "rejected".

Settings are:

Condition: User Defined
Action: Notify Requestors
Template: Global template: Error: no mandatory CF
Stage: TransactionBatch
Custom Condition:
my $trans = $self->TransactionObj;
return 0 unless $trans->Type eq "Create";

my $ticket = $self->TicketObj;

my $CustomFields = $ticket->QueueObj->TicketCustomFields();
while (my $CustomField = $CustomFields->Next()) {
    my $nam = $CustomField->Name;
    my $typ = $CustomField->Type;
    my $vad = $CustomField->Pattern;

    $RT::Logger->info( ">  CustomField: $nam \n" );
    $RT::Logger->info( ">  CustomField: $typ \n" );
    $RT::Logger->info( ">  CustomField: $vad \n" );

    if ($vad = '(?#Mandatory)') {
        my $val = $ticket->FirstCustomFieldValue($nam);
        if ($val ne '') {
            return 0;
        } else {
            $ticket->SetStatus("rejected");
        }
    }
}

return 1;

The scrip works as expected, but it will not send the email to the requestor. In the log I see this:

49587 - Scrip 28 OnCreateCheckCF (/opt/rtschedu/bin/../lib/RT/Action/SendEmail.pm:302)
[Thu Jun 11 07:53:27 2009] [info]: <rt-3.8.4-8458-1244706807-1237.3505-28-0 at Bankadati S.I.> No recipients found. Not sending. (/opt/rtschedu/bin/../lib/RT/Interface/Email.pm:338)

I can not understand why it is saying "No recipients found". Any ideas?

TIA
Bye
Cris

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bestpractical.com/pipermail/rt-users/attachments/20090611/06b8953d/attachment.htm>


More information about the rt-users mailing list