lib/mail/Mail.php
public function addHeader(
        $key,
        $value = null,
        $personalizationIndex = null,
        $personalization = null
    ) {
        $header = null;
        if ($key instanceof Header) {
            $h = $key;
            $header = new Header($h->getKey(), $h->getValue());
        } else {
            $header = new Header($key, $value);
        }
        if ($personalization != null) {
            $personalization->addHeader($header);
            $this->addPersonalization($personalization);
            return;
        } else {
            if ($this->personalization[0] != null) {
                $this->personalization[0]->addHeader($header);
            } else if ($this->personalization[$personalizationIndex] != null) {
                $this->personalization[$personalizationIndex]->addHeader($header);
            } else {
                $personalization = new Personalization();
                $personalization->addHeader($header);
                if (($personalizationIndex != 0)
                    && ($this->getPersonalizationCount() <= $personalizationIndex)
                ) {
                    $this->personalization[$personalizationIndex] = $personalization;
                } else {
                    $this->addPersonalization($personalization);
                }
            }
            return;
        }
    }
public function addHeader(
        $key,
        $value = null,
        $personalizationIndex = null,
        $personalization = null
    ) {
        $header = null;
        if ($key instanceof Header) {
            $h = $key;
            $header = new Header($h->getKey(), $h->getValue());
        } else {
            $header = new Header($key, $value);
        }
        if ($personalization != null) {
            $personalization->addHeader($header);
            $this->addPersonalization($personalization);
            return;
        } else {
            if ($this->personalization[0] != null) {
                $this->personalization[0]->addHeader($header);
            } else if ($this->personalization[$personalizationIndex] != null) {
                $this->personalization[$personalizationIndex]->addHeader($header);
            } else {
                $personalization = new Personalization();
                $personalization->addHeader($header);
                if (($personalizationIndex != 0)
                    && ($this->getPersonalizationCount() <= $personalizationIndex)
                ) {
                    $this->personalization[$personalizationIndex] = $personalization;
                } else {
                    $this->addPersonalization($personalization);
                }
            }
            return;
        }
    }
public function addHeader ( $ key , $ value = null , $ personalizationIndex = null , $ personalization = null ) { $ header = null ; if ( $ key instanceof Header ) { $ h = $ key ; $ header = new Header ( $ h -> getKey ( ) , $ h -> getValue ( ) ) ; } else { $ header = new Header ( $ key , $ value ) ; } if ( $ personalization != null ) { $ personalization -> addHeader ( $ header ) ; $ this -> addPersonalization ( $ personalization ) ; return ; } else { if ( $ this -> personalization [ 0 ] != null ) { $ this -> personalization [ 0 ] -> addHeader ( $ header ) ; } else if ( $ this -> personalization [ $ personalizationIndex ] != null ) { $ this -> personalization [ $ personalizationIndex ] -> addHeader ( $ header ) ; } else { $ personalization = new Personalization ( ) ; $ personalization -> addHeader ( $ header ) ; if ( ( $ personalizationIndex != 0 ) && ( $ this -> getPersonalizationCount ( ) <= $ personalizationIndex ) ) { $ this -> personalization [ $ personalizationIndex ] = $ personalization ; } else { $ this -> addPersonalization ( $ personalization ) ; } } return ; } }
Add a header to a Personalization or Mail object

If you don't provide a Personalization object or index, the
header will be global to entire message. Note that
headers added to Personalization objects override
global headers.

@param string|Header $key Key or Header object
@param string|null $value Value
@param int|null $personalizationIndex Index into an array of
existing Personalization
objects
@param Personalization|null $personalization A pre-created
Personalization object
Add a header to a Personalization or Mail object