function messaging_message_send in Messaging 6.4
Same name and namespace in other branches
- 5 messaging.module \messaging_message_send()
- 6 messaging.module \messaging_message_send()
- 6.2 messaging.module \messaging_message_send()
- 6.3 messaging.module \messaging_message_send()
Send message to array of destinations. The message is rendered just once.
Parameters
$destinations: Single destination or array of destinations for sending. The element type depends on sending method so it can be a list of e-mail addresses, user accounts, etc
$message: Message object or array of message parts.
$method: Sending method. Unlike for messaging_message_send_user() for which the sending method may be user's default it is not an optional parameter for this function.
$queue: Optional flag to force queueing. We may want to force queueing for bulk messaging. Otherwise it will depend on the sending method wether to queue the messages (for pull methods) or not (push methods)
3 calls to messaging_message_send()
- messaging_admin_test_post_form_submit in ./
messaging.admin.inc - Post test message
- Messaging_API_Tests::testMessagingBasicAPI in tests/
messaging_api.test - Exercise basic API functions
- Messaging_Methods_Tests::testMessagingMethods in tests/
messaging_methods.test - Test message sending callbacks for enabled plug-ins
File
- ./
messaging.module, line 235
Code
function messaging_message_send($destinations, $message, $method, $queue = FALSE) {
messaging_debug('Sending message', array(
'destinations' => $destinations,
'message' => $message,
'method' => $method,
'queue' => $queue,
));
// Convert into an object and add all the information into the message object
$message = messaging_message_build($message);
$message->method = $method;
if (is_array($destinations)) {
$message
->set_multiple($destinations);
}
else {
$message
->set_destination($destinations);
}
// This will return true if the message was sent or queued for delivery
return $queue ? $message
->queue() : $message
->send();
}