Introduction   Getting Started   Upgrading   Function Reference   Changelog   Support and Feedback

write_pm

Usage: bool write_pm (int recepient_id, string subject, string message[, array ccusersid[, bool sentitems]])
Purpose: Creates a new personal message.
Availability: IPB SDK 0.2

Returns TRUE if a message could be sent to the forum account id recepient_id, with the subject subject and message message.

You can also provide an array of account ids in ccusersid, of which messages will also be sent to.

As of IPB SDK Version 0.3, if sentitems is set to TRUE a copy of the message will be saved in the Sent Items Folder. Previous Versions do not support the sentitems argument, and will not save a copy of the message.

If the message could not be sent, due to invalid input or any other reasons FALSE will be returned. The error message can be accessed with sdk_error.

/* Sends a PM to User ID 1 with the Subject Hello! */
$SDK->write_pm ("1", "Hello!", "Hello! This is a test message sent to user id 1");

/* Sends a PM to User ID 1 with the Subject Hello!, and CCs to users 2, 3 and 4 */
$SDK->write_pm ("1", "Hello!", "Hello! This is a test message sent to user id 1", array("2", "3", "4"));

/* Sends a message to member "bob" */
$SDK->write_pm ($SDK->name2id("bob"), "Hello!", "Hello! This is a test message sent to user id 1");

/* Message Sender with Error Catcher */
if (!$SDK->write_pm ($userid, $subject, $message)) {
      echo $SDK->sdk_error();
}
else {
      echo 'Message Sent!';
}

/* Sends a message to member "cow" and keeps a copy in the Sent Items folder */
$SDK->write_pm ($SDK->name2id("cow"), "Hiya", "Hello Cow :)", array(), "1");

See Also: save_pm


User Contributed Notes

There are currently no user contributed notes for this page.

Documentation Generated at Sat, 16 Apr 2005 07:36:35 -0700
Find the latest version at http://ipbsdk.sourceforge.net