require_once MYBB_ROOT."inc/datahandlers/pm.php";$pmhandler=new PMDataHandler();$pm=array('subject'=>"Your thread has been stucked !",'message'=>"Hello ! a one of your thread has been stucked successfully. Its an automated Private Message, so please don't reply to it. Thank You",'icon'=>'','toid'=>$thread['uid'],'fromid'=>$pmsender,"do"=>'',"pmid"=>'',);$pm['options']=array('signature'=>'1','savecopy'=>'1','disablesmilies'=>'0','readreceipt'=>'0',);$pmhandler->set_data($pm);$valid_pm=$pmhandler->validate_pm();if($valid_pm){$pmhandler->insert_pm();}
Sorry, don't have the time to really check everything, but are you sure that "toid" is meant to be set? private.php doesn't seem to do so.
Double check and see what private.php does. Also, try tracing your code - for example does it validate?