labrocca and crazy4cs, you have both been integral in finally solving this problem! I didn't think it made sense that toid would be required to be an array but when I checked the PM code from the VIP Membership plugin, that's exactly how it was set up. I tried it and it worked! Thank you both, as well as everyone else who helped us!
For anyone who happens to stumble upon this thread and is curious or would like a working function pre-written, here's what I used (with a slight modification to the include path to make it more generic):
function sendPM($subject, $message, $to, $from)
{
global $mybb
require_once(MYBB_ROOT . "inc/datahandlers/pm.php");
$pmhandler = new PMDataHandler();
$pmhandler->admin_override = true;
$pm = array(
"subject" => $subject,
"message" => $message,
"icon" => "-1",
"toid" => array(),
"fromid" => $from,
"do" => "",
"pmid" => ""
);
$pm["options"] = array(
"signature" => "0",
"disablesmilies" => "0",
"savecopy" => "0",
"readreceipt" => "0"
);
if(!is_array($to))
{
array_push($pm["toid"], $to);
}
else
{
foreach($to as $uid)
{
array_push($pm["toid"], $uid);
}
}
$pmhandler->set_data($pm);
if($pmhandler->validate_pm())
{
$pmhandler->insert_pm();
return true;
}
else
{
return false;
}
}