You are here

function _simplenews_headers in Simplenews 6

Same name and namespace in other branches
  1. 6.2 includes/simplenews.mail.inc \_simplenews_headers()

Build header array with priority and receipt confirmation settings.

Parameters

$node: node object:

$from: from email address:

Return value

Header array with priority and receipt confirmation info

1 call to _simplenews_headers()
simplenews_mail in ./simplenews.module
Implementation of hook_mail().

File

./simplenews.module, line 2057
Simplnews node handling, sent email, newsletter block and general hooks

Code

function _simplenews_headers($node, $from) {
  $headers = array();

  // If receipt is requested, add headers.
  if ($node->simplenews['receipt']) {
    $headers['Disposition-Notification-To'] = $from;
    $headers['X-Confirm-Reading-To'] = $from;
  }

  // Add priority if set.
  switch ($node->simplenews['priority']) {
    case SIMPLENEWS_PRIORITY_HIGHEST:
      $headers['Priority'] = 'High';
      $headers['X-Priority'] = '1';
      $headers['X-MSMail-Priority'] = 'Highest';
      break;
    case SIMPLENEWS_PRIORITY_HIGH:
      $headers['Priority'] = 'urgent';
      $headers['X-Priority'] = '2';
      $headers['X-MSMail-Priority'] = 'High';
      break;
    case SIMPLENEWS_PRIORITY_NORMAL:
      $headers['Priority'] = 'normal';
      $headers['X-Priority'] = '3';
      $headers['X-MSMail-Priority'] = 'Normal';
      break;
    case SIMPLENEWS_PRIORITY_LOW:
      $headers['Priority'] = 'non-urgent';
      $headers['X-Priority'] = '4';
      $headers['X-MSMail-Priority'] = 'Low';
      break;
    case SIMPLENEWS_PRIORITY_LOWEST:
      $headers['Priority'] = 'non-urgent';
      $headers['X-Priority'] = '5';
      $headers['X-MSMail-Priority'] = 'Lowest';
      break;
  }

  // Add general headers
  $headers['Precedence'] = 'bulk';
  return $headers;
}