public function MessageNotifierEmail::deliver in Message Notify 7.2
Deliver a message via the required transport method.
Parameters
$output: Array keyed by the view mode, and the rendered entity in the specified view mode.
Return value
TRUE or FALSE based on delivery status.
Overrides MessageNotifierBase::deliver
File
- plugins/
notifier/ email/ MessageNotifierEmail.class.php, line 8
Class
- MessageNotifierEmail
- Email notifier.
Code
public function deliver(array $output = array()) {
$plugin = $this->plugin;
$message = $this->message;
$options = $plugin['options'];
$account = user_load($message->uid);
$mail = $options['mail'] ? $options['mail'] : $account->mail;
$languages = language_list();
if (!$options['language override']) {
$lang = !empty($account->language) && $account->language != LANGUAGE_NONE ? $languages[$account->language] : language_default();
}
else {
$lang = $languages[$message->language];
}
// The subject in an email can't be with HTML, so strip it.
$output['message_notify_email_subject'] = strip_tags($output['message_notify_email_subject']);
// Pass the message entity along to hook_drupal_mail().
$output['message_entity'] = $message;
$result = drupal_mail('message_notify', $message->type, $mail, $lang, $output);
return $result['result'];
}