webCOMAND

mail::headers()

Add or update an array of email headers.  To set a single header, see mail::header().

Prototype

void headers(array $headers = [])

Parameters

  • headers - Associative array of key/value pairs, where the key is the header name and value is the optional value.  A value of NULL means no value, so only the header name is included.  As an alternative, a simple array of email header strings may also be provided, where the header key and value is separated by a colon, which is how it appears in actual email headers.

Example

$mail = new \io_comand_email\mail(
    'webmaster@webcomand.com',
    'Testing',
    "<p>This is a test.<br/>\nTesting 1, 2, 3.</p>"
);
$mail->headers([
    'Content-Type' => 'text/html; charset=UTF-8',
    'X-Custom-Header' => NULL
]);
$mail->send();

Related

header()