public function addHeaderArray($header_array) {
    if (!is_array($header_array)) {
      $error = sprintf("Input is not an array (Actual type: %s).",
                       gettype($header_array));
      throw new \InvalidArgumentException($error);
    }

    $error = "";
    foreach($header_array as $key => $value) {
      if (!$this->checkValidHeader($key, $value, $error)) {
        throw new \InvalidArgumentException($error);
      }
    }

    foreach($header_array as $key => $value) {
      $new_header = $this->message->addHeader();
      $new_header->setName($key);
      $new_header->setValue($value);
    }
  }
public function addHeaderArray($header_array) {
    if (!is_array($header_array)) {
      $error = sprintf("Input is not an array (Actual type: %s).",
                       gettype($header_array));
      throw new \InvalidArgumentException($error);
    }

    $error = "";
    foreach($header_array as $key => $value) {
      if (!$this->checkValidHeader($key, $value, $error)) {
        throw new \InvalidArgumentException($error);
      }
    }

    foreach($header_array as $key => $value) {
      $new_header = $this->message->addHeader();
      $new_header->setName($key);
      $new_header->setValue($value);
    }
  }
public function addHeaderArray ( $ header_array ) { if ( ! is_array ( $ header_array ) ) { $ error = sprintf ( "Input is not an array (Actual type: %s)." , gettype ( $ header_array ) ) ; throw new \ InvalidArgumentException ( $ error ) ; } $ error = "" ; foreach ( $ header_array as $ key => $ value ) { if ( ! $ this -> checkValidHeader ( $ key , $ value , $ error ) ) { throw new \ InvalidArgumentException ( $ error ) ; } } foreach ( $ header_array as $ key => $ value ) { $ new_header = $ this -> message -> addHeader ( ) ; $ new_header -> setName ( $ key ) ; $ new_header -> setValue ( $ value ) ; } }
Adds an array of headers to the mail object.

@param array An array of headers.
@throws \InvalidArgumentException If the input is not an array, or if
headers are not on the whitelist, or if a header is invalid
(i.e. not a string).
Adds an array of headers to the mail object .