You are here

function user_import_mail in User Import 7.3

Same name and namespace in other branches
  1. 8 supported/user_import.inc \user_import_mail()
  2. 6.4 supported/user_import.inc \user_import_mail()
  3. 6.2 supported/user_import.inc \user_import_mail()
  4. 7 supported/user_import.inc \user_import_mail()
  5. 7.2 user_import.module \user_import_mail()

Implementation of hook_mail().

File

./user_import.module, line 861
Import or update users with data from a comma separated file (csv).

Code

function user_import_mail($key, &$message, $params) {
  switch ($key) {
    case 'welcome':
      $message['subject'] = empty($params['subject']) ? _user_mail_text('register_admin_created_subject', $message['language'], $params) : strtr($params['subject'], $params);
      $body = empty($params['body']) ? _user_mail_text('register_admin_created_body', $message['language'], $params) : strtr($params['body'], $params);
      if ($params['email_format'] == 1) {
        $message['headers']['Content-Type'] = 'text/html; charset=UTF-8';
        $body_head = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
	            <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
	            <head>
	            <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />';
        if (!empty($params['css'])) {
          $body_head .= '<style type="text/css">' . check_plain($params['css']) . '</style>';
        }
        $message['body'][] = $body_head . '</head><body>' . $body . '</body></html>';
      }
      else {
        $message['body'][] = $body;
      }
      break;
  }
}