Mail_Mime::headers() – build the header lines


require_once 'Mail/mime.php';

array &headers ( array $xtra_headers = null , boolean $overwrite = false , boolean $skip_content = false )


Returns an array with the headers needed to prepend to the email (MIME-Version and Content-Type). Please note that the function get() has to be called before calling headers().


  • array $xtra_headers - Additional headers, the format of the argument is $array["header-name"] = "header-value"

  • boolean $overwrite - Overwrite already existing headers. When FALSE, the values already set are kept.

  • boolean $skip_content Don't return content headers: Content-Type, Content-Disposition and Content-Transfer-Encoding.

Return value

array - an associative array with the mime headers and the additional headers. The return value can directly passed to the second parameter of Mail::send().


This function can not be called statically.

Mail_Mime::headers() has to be called after Mail_Mime::get().