You are here

function sparkpost_allowed_headers in Sparkpost email 7.2

Same name and namespace in other branches
  1. 7 sparkpost.module \sparkpost_allowed_headers()

Limit headers to SparkPost whitelist.

Parameters

array $headers: Array of headers.

Return value

array Array of headers.

1 call to sparkpost_allowed_headers()
SparkpostMailSystem::mail in includes/sparkpost.mail.inc
Send the email message.

File

./sparkpost.module, line 234
Sparkpost integration.

Code

function sparkpost_allowed_headers($headers = array()) {
  foreach ($headers as $header => $value) {
    if (strpos($header, 'X-') === 0) {
      continue;
    }
    elseif (in_array($header, array(
      'Return-Path',
      'Cc',
    ))) {

      // Only Return-Path and Cc are supported.
      // Bcc recipients will be added to recipient list automatically and
      // removed from here.
      continue;
    }
    unset($headers[$header]);
  }
  return $headers;
}