Adds all the Microsoft message headers.  Returns string.
@private
@returns string
540694
function AddMSMailHeaders() {
      $MSHeader = "";
      if($this->Priority == 1)
         $MSPriority = "High";
      elseif($this->Priority == 5)
         $MSPriority = "Low";
      else
         $MSPriority = "Medium";

      $MSHeader .= sprintf("X-MSMail-Priority: %s\r\n", $MSPriority);
      $MSHeader .= sprintf("Importance: %s\r\n", $MSPriority);

      return($MSHeader);
   }
1077391
function parseHeaders(xhr) {
  const pairs = xhr.getAllResponseHeaders().trim().split('\n');
  const headers = {};
  pairs.forEach((header) => {
    const split = header.trim().split(':');
    const key = split.shift().trim().toLowerCase();
    const value = split.join(':').trim();
    headers[key] = value;
  });
  return headers;
}
881335
public function addHeader()
    {
        if (ord($this->BUF[0]{10}) & 0x80) {
            $cmap = 3 * (2 << (ord($this->BUF[0]{10}) & 0x07));
            $this->GIF .= substr($this->BUF[0], 6, 7);
            $this->GIF .= substr($this->BUF[0], 13, $cmap);
            $this->GIF .= "!\377\13NETSCAPE2.0\3\1" . $this->word($this->LOP) . "\0";
        }
    }
539656
private function addHeader()
    {
        $auth = '<NS1:Security xmlns:NS1="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd"><NS2:Timestamp xmlns:NS2="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"><Created xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' . date('Y-m-d\TH:i:s.811P') . '</Created><Expires xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">' . date('Y-m-d\TH:i:s.811P',
                time() + (5 * 60)) . '</Expires></NS2:Timestamp><NS1:UsernameToken><Username xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' . $this->login . '</Username><Password xmlns="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">' . $this->password . '</Password></NS1:UsernameToken></NS1:Security>';


        $authvalues = new \SoapVar($auth, XSD_ANYXML);
        $header     = new \SoapHeader("http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd",
            "Security", $authvalues, true);

        $this->getSoap()->__setSoapHeaders($header);
    }
323897
function getResponseHeader(sHeaderName) {
		var sResponseHeader;

		sHeaderName = sHeaderName.toLowerCase();

		for (sResponseHeader in this.headers) {
			if (sResponseHeader.toLowerCase() === sHeaderName) {
				return this.headers[sResponseHeader];
			}
		}
	}
405972
public T headers(Map<String, Object> headers) {
        getMessageContentBuilder().getMessageHeaders().putAll(headers);
        return self;
    }
412694
function Headers(headers) {
	            var _this = this;
	            /** @internal header names are lower case */
	            this._headers = new Map();
	            /** @internal map lower case names to actual names */
	            this._normalizedNames = new Map();
	            if (!headers) {
	                return;
	            }
	            if (headers instanceof Headers) {
	                headers._headers.forEach(function (values, name) {
	                    values.forEach(function (value) { return _this.append(name, value); });
	                });
	                return;
	            }
	            Object.keys(headers).forEach(function (name) {
	                var values = Array.isArray(headers[name]) ? headers[name] : [headers[name]];
	                _this.delete(name);
	                values.forEach(function (value) { return _this.append(name, value); });
	            });
	        }
43553
function getMessages(result) {
  let messages = [];
  if (result.messages) {
    messages = messages.concat(result.messages);
  }
  if (result.schemaValidationMessages) {
    messages = messages.concat(
      result.schemaValidationMessages.map((m) => `${m.level}: ${m.message}`)
    );
  }
  return messages;
}
864930
protected function add_message_header() {
        $site = get_site();

        // Set the subject of the message.
        $this->postsubject = get_string('digestmailsubject', 'forum', format_string($site->shortname, true));

        // And the content of the header in body.
        $headerdata = (object) [
            'sitename' => format_string($site->fullname, true),
            'userprefs' => (new \moodle_url('/user/forum.php', [
                    'id' => $this->recipient->id,
                    'course' => $site->id,
                ]))->out(false),
            ];

        $this->notificationtext .= get_string('digestmailheader', 'forum', $headerdata) . "\n";

        if ($this->allowhtml) {
            $headerdata->userprefs = html_writer::link($headerdata->userprefs, get_string('digestmailprefs', 'forum'), [
                    'target' => '_blank',
                ]);

            $this->notificationhtml .= html_writer::tag('p', get_string('digestmailheader', 'forum', $headerdata));
            $this->notificationhtml .= html_writer::empty_tag('br');
            $this->notificationhtml .= html_writer::empty_tag('hr', [
                    'size' => 1,
                    'noshade' => 'noshade',
                ]);
        }
    }
329735
private static function getHeadersFromInput ()
	{
		// getallheaders available, use that
		if (function_exists('getallheaders')) return getallheaders();

		// getallheaders not available: manually extract 'm
		$headers = [];
		foreach ($_SERVER as $name => $value)
		{
			if (substr($name, 0, 5) == 'HTTP_') {
			    $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($name, 5)))));
				$headers[$key] = $value;
			} else if (strtolower (substr ($name, 0, 7)) == 'content') {
                $key = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', $name))));
				$headers[$key] = $value;
			}
		}
		return $headers;
	}
260108
private function getHeaders()
    {
        $result = [];
        foreach ($this->headers as $name => $value) {
            $result[] = sprintf("%s: %s", $name, $value);
        }

        return $result;
    }
1195354
private function buildHeaders() {

		$this->headers = [
			'From' => $this->sender,
			'Return-Path' => $this->sender,
			'Reply-To' => $this->sender,
			'Date' => (new \DateTime())->format('r'),
			'Message-ID' => '<'.sha1(microtime()) . '@' . substr($this->sender, strpos($this->sender, '@') + 1) . '>',
			'User-Agent' => 'vxPHP SmtpMailer',
			'X-Mailer' => 'PHP' . phpversion(),
			'MIME-Version' => '1.0'
		];

		if(!empty($this->cc)) {
			$this->headers['CC'] = implode(',', $this->cc);
		}

		if(!empty($this->bcc)) {
			$this->headers['BCC'] = implode(',', $this->bcc);
		}

		if(count($this->attachments) > 0) {
			$this->boundary = '!!!@snip@here@!!!';
			$this->headers['Content-type'] = sprintf('multipart/mixed; boundary="%s"', $this->boundary);
		}
		else {
			$this->headers['Content-type'] = sprintf('text/%s; charset=%s', $this->htmlMail ? 'html' : 'plain', $this->encoding);
		}

	}
465508
def headers(self):
        
        d = {}
        for k, v in self.message.items():
            d[k] = decode_header_part(v)
        return d
674880
public function addRequestHeaders($headers)
    {
        $currency = $this->client->getCurrencyCode();
        if (!empty($currency)) {
            $headers['X-MOLTIN-CURRENCY'] = $this->client->getCurrencyCode();
        }
        return $headers;
    }
589438
public function getHeaders()
    {
        if (!isset($this->properties[MessageProperties::KEY_HEADERS])) {
            $this->properties[MessageProperties::KEY_HEADERS] = [];
        }

        return $this->properties[MessageProperties::KEY_HEADERS];
    }
752457
private static Map<String, List<String>> getOrCreateProtocolHeader(
            Message message) {
        Map<String, List<String>> headers = CastUtils.cast((Map<?, ?>) message
                .get(Message.PROTOCOL_HEADERS));
        if (headers == null) {
            headers = new HashMap<String, List<String>>();
            message.put(Message.PROTOCOL_HEADERS, headers);
        }
        return headers;
    }
820658
function addAuthHeaders ({ 
  auth,
  bearerToken, 
  headers, 
  overrideHeaders=false, 
}) {
  if (overrideHeaders) return
  if (bearerToken) return { 
    headers: { ...headers, Authorization: `Bearer ${ bearerToken }` } 
  }
  if (auth) {
    const username = auth.username || ''
    const password = auth.password || ''
    const encodedToken = Base64.btoa(`${ username }:${ password }`)
    return {
      headers: { ...headers, Authorization: `Basic ${ encodedToken }` }
    }
  }
}