[rt-devel] help needed creating tickets via script.(not scrip)

Matthew Watson mwatson at office.netspace.net.au
Wed Apr 10 00:37:55 EDT 2002


Heya.

 I'm trying to create a ticket from a perl script. everything is fine,
except I get the message

"RT::Action::Autoreply=HASH(0x87565c8): Could not send mail for
RT::Transaction=HASH(0x87255a4)"

However... the requestor is sent an email.. this error message does not
happen when a ticket in created via the web interface or email...

the code I have is as follows ..

There is only ever 1 requestor, and i've confirmed that the requestors array
doesn't have any weird stuff in it.. any ideas??


--------------------------------------------------------------------

my $MIMEObj = MIME::Entity->build(Data => \@message);

    #Load the user
    my $CurrentUser = new RT::CurrentUser();
    $CurrentUser->LoadByEmail($info->{'Requestor'});
    unless ($CurrentUser->id){
      print "Error:Could not load user\r\n";
      exit;
    }

#    print Dumper($CurrentUser);
    #make sure the queue is valid
    my $QueueObj = new RT::Queue($RT::SystemUser);
    unless($QueueObj->Load($info->{'Queue'})){
      print "Error:Invalid Queue\r\n";
      exit;
    }
    my @requestors = ($CurrentUser->id);
    print Dumper(\@requestors);
    my $Ticket = new RT::Ticket($CurrentUser);
    my ($ticket,$trans,$msg) = $Ticket->Create(Queue => $QueueObj,
                                               Status => 'new',
                                              Subject => $info->{'Subject'},
                                              Requestor => \@requestors,
                                              MIMEObj => $MIMEObj);

    if ($ticket == 0 ) {
        print "Error: $msg\r\n";
    } else {
        print "TicketID: $ticket\r\n";
    }
    exit;
---------------------------------------------------------------------------

Regards
----------------------------------------------
Matthew Watson
Development, Netspace Online Systems
mwatson at netspace.net.au





More information about the Rt-devel mailing list