You are here

public function HTMLMailSystem::txtHeaders in HTML Mail 7.2

Same name and namespace in other branches
  1. 8.2 htmlmail.mail.inc \HTMLMailSystem::txtHeaders()
  2. 6.2 htmlmail.mail.inc \HTMLMailSystem::txtHeaders()

Converts an array of email headers to a text string.

Parameters

array $headers: An associative array of ('HeaderName' => 'header value') pairs.

Return value

string The concatenated headers as a single string.

1 call to HTMLMailSystem::txtHeaders()
HTMLMailSystem::mail in ./htmlmail.mail.inc
Send an email message.

File

./htmlmail.mail.inc, line 342
Formats and sends mail using the MailMIME class.

Class

HTMLMailSystem
Implements MailSystemInterface.

Code

public function txtHeaders(array $headers) {
  $output = array();
  foreach ($headers as $name => $value) {
    if (is_array($value)) {
      foreach ($value as $val) {
        $output[] = "{$name}: {$val}";
      }
    }
    else {
      $output[] = "{$name}: {$value}";
    }
  }
  return implode("\n", $output);
}