class OaEmail in Open Atrium Core 7.2
Email notifier.
Hierarchy
- class \MessageNotifierBase implements MessageNotifierInterface
- class \MessageNotifierEmail
- class \OaEmail
- class \MessageNotifierEmail
Expanded class hierarchy of OaEmail
1 string reference to 'OaEmail'
- oa_email.inc in modules/
oa_messages/ plugins/ message_notify/ notifier/ oa_email/ oa_email.inc
File
- modules/
oa_messages/ plugins/ message_notify/ notifier/ oa_email/ OaEmail.class.php, line 14 - Provides a message notifier that extends the default's email capabilities with some Open Atrium specific additions.
View source
class OaEmail extends MessageNotifierEmail {
/**
* Override parent deliver() function.
*/
public function deliver(array $output = array()) {
$plugin = $this->plugin;
$message = $this->message;
$options = $plugin['options'];
$account = user_load($message->uid);
$mail = !empty($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']);
// Allow for overriding the 'from' of the message.
$from = isset($options['from']) ? $options['from'] : NULL;
$from_account = !empty($message->user->uid) ? user_load($message->user->uid) : $account;
$mimemail_name = variable_get('mimemail_name', t('Atrium'));
$from = array(
'name' => oa_core_realname($from_account) . ' (' . $mimemail_name . ')',
'mail' => is_array($from) ? $from['mail'] : $from,
);
// Pass the message entity along to hook_drupal_mail().
$output['message_entity'] = $message;
if (!empty($message->email_attachments)) {
$output['attachments'] = isset($output['attachments']) ? $output['attachments'] : array();
$output['attachments'] = array_merge($message->email_attachments, $output['attachments']);
}
return drupal_mail('message_notify', $message->type, $mail, $lang, $output, $from);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
MessageNotifierBase:: |
protected | property | The message entity. | |
MessageNotifierBase:: |
protected | property | The plugin definition. | |
MessageNotifierBase:: |
public | function |
Determine if user can access notifier. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public | function |
Act upon send result. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public | function |
Entry point to send and process a message. Overrides MessageNotifierInterface:: |
|
MessageNotifierBase:: |
public | function |
Constructor for the notifier. Overrides MessageNotifierInterface:: |
|
OaEmail:: |
public | function |
Override parent deliver() function. Overrides MessageNotifierEmail:: |