You are here

function backup_migrate_mail in Backup and Migrate 7.3

Same name and namespace in other branches
  1. 7.2 backup_migrate.module \backup_migrate_mail()

Implements hook_mail().

File

./backup_migrate.module, line 2106
Backup and restore databases for Drupal.

Code

function backup_migrate_mail($key, &$message, $params) {
  if ($key == 'backup_succeed') {
    $message['id'] = 'backup_migrate_backup_succeed';
    $message['subject'] = t('!site backup succeeded', array(
      '!site' => variable_get('site_name', 'Drupal site'),
    ));
    $message['body'][] = $params['body'];
  }
  elseif ($key == 'backup_fail') {
    $message['id'] = 'backup_migrate_backup_fail';
    $message['subject'] = t('!site backup failed', array(
      '!site' => variable_get('site_name', 'Drupal site'),
    ));
    $message['body'][] = $params['body'];
  }
  elseif ($key == 'destination_mail') {

    // @todo translate subject and parts of the body?
    $message['subject'] = $params['subject'];
    $message['body'][] = $params['body'];
    $message['headers'] = array_merge($message['headers'], $params['headers']);
  }
}