Haven't worked with vB5 but seems that you're missing something. You've in your code:
PHP Code:
$pmdm->set_recipients($recipients, $botpermissions);
but unless if I'm blind, can't see the value assigment for variable: $botpermissions. You must give admin permissions for PMs to be sure that it will bypass any restriction (eg total amount of PMs, PMs per xxx time)
For vB4 I was using:
PHP Code:
// Bypass message amount restrictions
$botpermissions['adminpermissions'] = 2;
$pmSystem->set_recipients($item["username"], $botpermissions);