$headers = array( 'MIME-Version: 1.0', 'Content-Type: text/html; charset="UTF-8"', 'Content-Transfer-Encoding: base64', 'From: sender@example.com', 'Reply-To: sender@example.com', 'X-Mailer: PHP/' . phpversion() ); $body = ''; mail('recipient@example.com', 'Test email with embedded image', base64_encode($body), implode("\r\n", $headers));
$headers = array( 'X-Custom-Header: value', 'X-Track-Id: abc123', 'From: sender@example.com', 'Reply-To: sender@example.com', 'X-Mailer: PHP/' . phpversion() ); $body = 'Hello world!'; mail('recipient@example.com', 'Test email with custom headers', $body, implode("\r\n", $headers));The PHP Mail Raw function is part of the PHP core function library and does not require any additional package libraries.