You are here

function _mass_contact_prepare_header in Mass Contact 7

Prepares the message's header.

This currently only sets the character set, but it's left here for potential future additions.

Parameters

string $format: The input text format the message was created with.

Return value

array The prepared header.

1 call to _mass_contact_prepare_header()
mass_contact_mail_page_submit in ./mass_contact.page.inc
Processes the main Mass Contact mail form.

File

./mass_contact.page.inc, line 827
The main form for creating and sending the messages.

Code

function _mass_contact_prepare_header($format) {
  $params = array();

  // Get the character set. If variable_get returns NULL or an empty string, it
  // is set UTF-8.
  $character_set = variable_get('mass_contact_character_set');
  if (empty($character_set)) {
    $character_set = 'UTF-8';
  }
  if (!empty($format) && $format == 'plain_text') {
    $params['headers']['Content-Type'] = 'text/plain; charset=' . $character_set . '; format=flowed';
  }
  elseif (module_exists('mimemail')) {

    // Mime Mail requires this header or it will filter all text.
    $params['headers']['Content-Type'] = 'text/html; charset=UTF-8';
  }
  else {
    $params['headers']['Content-Type'] = 'text/plain; charset=' . $character_set . '; format=flowed';
  }
  return $params;
}