function _mass_contact_send_message in Mass Contact 7
Same name and namespace in other branches
- 6 mass_contact.module \_mass_contact_send_message()
Sends the message.
Parameters
string $message_key: A key to identify the email sent.
string $to: To whom the message will be delivered.
array $params: The message array.
string $from_email: The message sender's email address.
string $success_message: The message that will be displayed to the user, if sending is successful.
Return value
bool The result of the call to drupal_mail(): The $message array structure containing all details of the message. If already sent ($send = TRUE), then the 'result' element will contain the success indicator of the email, failure being already written to the watchdog. (Success means nothing more than the message being accepted at php-level, which still doesn't guarantee it to be delivered.)
2 calls to _mass_contact_send_message()
- mass_contact_mail_page_submit in ./
mass_contact.page.inc - Processes the main Mass Contact mail form.
- _mass_contact_prepare_message_for_sending in ./
mass_contact.module - This is for preparing a message that has been queued for sending.
File
- ./
mass_contact.module, line 439 - This is the main code file for the Mass Contact module.
Code
function _mass_contact_send_message($message_key, $to, array &$params, $from_email, $success_message) {
$success = drupal_mail('mass_contact', $message_key, $to, language_default(), $params, $from_email);
// Capture the rate limiting information.
$recipient_limit = variable_get('mass_contact_recipient_limit', 0);
$wait_time = variable_get('mass_contact_wait_time', 0);
if ($success['result']) {
if (empty($recipient_limit) && empty($wait_time)) {
drupal_set_message(t($success_message));
}
else {
watchdog('mass_contact', $success_message);
}
}
return $success['result'];
}