Here's how i would make it in vB4
PHP Code:
<?
$pmSystem = datamanager_init('PM', $vbulletin, ERRTYPE_ARRAY);
//pm Titel / Text
$pnTitel = "Your Title for the PM";
$pnText = "This is pm which was created automatically. Please do not reply to this pm.";
$pmSystem->verify_message( $pnText );
$pmSystem->verify_title( $pnTitel );
//Set the fields
$pmSystem->set('fromuserid', 1);
$pmSystem->set('fromusername', 'Meeting Bot');
$pmSystem->set_r('title', $pnTitel);
$pmSystem->set_r('message', $pnText);
$pmSystem->set('dateline', TIMENOW);
$pmSystem->set('iconid', 4);
$pmSystem->set_recipients("bpr");
if ( $pmSystem->pre_save() === false )
{
if ($pmSystem->errors) {
# do something with $pmSystem->errors array for example
# because youre return helps not, $pmSystem->errors is a array;)
# so you could do for debuging a var_dump or die(print_r( ....
require_once DIR . '/includes/functions_newpost.php';
$template_errors = construct_errors($errors);
# now you can use $template_errors for a nice output;)
$show['pmerror'] = true;
}
}
else
{
$newpmid = $pmSystem->save();
}