Doc #78018 [Opn->Nab]: mail() expects parameter 4 to be string

From: Date: Wed, 15 May 2019 19:20:16 +0000
Subject: Doc #78018 [Opn->Nab]: mail() expects parameter 4 to be string
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-16658@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78018&edit=1 ID: 78018 Updated by: peehaa@php.net Reported by: 888 at foshin dot com Summary: mail() expects parameter 4 to be string -Status: Open +Status: Not a bug Type: Documentation Problem Package: Mail related PHP Version: 7.1.29 Block user comment: N Private report: N New Comment: Thank you for taking the time to write to us, but this is not a bug. Please double-check the documentation available at http://www.php.net/manual/ and the instructions on how to report a bug at http://bugs.php.net/how-to-report.php Passing in an array is only available as of 7.2: https://php.net/function.mail#refsect1-function.mail-changelog Previous Comments: ------------------------------------------------------------------------ [2019-05-15 19:16:00] 888 at foshin dot com My host's settings page says so.. but echo phpversion(); says 7.1.29. ------------------------------------------------------------------------ [2019-05-15 19:11:00] peehaa@php.net Are you sure you are on 7.2? ------------------------------------------------------------------------ [2019-05-15 19:07:08] 888 at foshin dot com Description: ------------ --- From manual page: https://php.net/function.mail --- "Warning: mail() expects parameter 4 to be string, array given" even though the manual says "String or array to be inserted at the end of the email header." and "If an array is passed, its keys are the header names and its values are the respective header values.". Test script: --------------- mail("Joe <joe@joe.com>", "Bug", ":(", array("From" => "Joe <joe@joe.com>", "To" => "Joe <joe@joe.com>", "Reply-To" => "Joe <joe@joe.com>", "X-Mailer" => "NOOOooo", "MIME-Version" => "1.0", "Content-type" => "text/html; charset=utf-8", "Date" => date("r"))) Expected result: ---------------- No warning and the mail function actually working. Actual result: -------------- "Warning: mail() expects parameter 4 to be string, array given" ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78018&edit=1

« previous php.doc.bugs (#16658) next »