You are here

function devel_mail_logger_mail in Devel Mail Logger 7

Same name and namespace in other branches
  1. 8 devel_mail_logger.module \devel_mail_logger_mail()

Implements hook_mail().

File

./devel_mail_logger.module, line 66

Code

function devel_mail_logger_mail($key, &$message, $params) {
  $options = array(
    'langcode' => $message['langcode'],
  );
  switch ($key) {
    case 'send_test':
      $message['from'] = variable_get('site_mail');
      $message['subject'] = t('Your mail subject Here: @subject', array(
        '@subject' => $params['subject'],
      ), $options);
      if (is_array($params['message'])) {
        $message['body'] = $params['message'];
      }
      else {
        $message['body'][] = $params['message'];
      }
      break;
    case 'send_mail':
      $message['from'] = variable_get('site_mail');
      $message['subject'] = $params['subject'];
      $message['from_devel_mail_logger'] = TRUE;
      $message['body'] = $params['body'];
      break;
  }
}