Navigation

Search

sendpm

Description

Sends a personal message from the specified person to the specified people.

Syntax

array sendpm (array $recipients, string $subject, string $message, bool $outbox_store[, array $from])



Parameter $recipients

Expected type: Array
Description: An array containing recipient info

Array Elements of $recipients
Key Optional Expected type Description
bcc no Array An array of recipients from the "bcc" field
to no Array An array of recipients from the "to" field



Parameter $subject

Expected type: String
Description: The subject of the PM



Parameter $message

Expected type: String
Description: The message



Parameter $outbox_store

Expected type: Boolean
Description: Whether or not to store this PM in the sender's outbox. Depends on the appropriate profile setting.



Parameter $from

Expected type: Array
Description: An array with information about the sender of the PM. If not specified, it will be assumed that the current user is the sender.

Array Elements of $from
Key Optional Expected type Description
id no Integer The member ID of the sender
name no String The sender's display name
username no String The sender's username



Return value

Expected type: Array
Description: $log, an array of log info

Array Elements
Key Optional Expected type Description
failed no Array An array containing information about each recipient that the message couldn't be sent to, and why the message couldn't be sent to that recipient
sent no Array An array containing information about each recipient that the message was successfully sent to


Notes

  • Recipients should be an array containing the arrays 'to' and 'bcc', both containing ID_MEMBERs.
  • Subject and message should have no slashes and no html entities.
  • From is an array, with the id, name, and username of the member.
  • Returns an array with log entries telling how many recipients were successful and which recipients it failed to send to.
View all versions of this function