php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #41091 mail() Function only allows 5 arguments
Submitted: 2007-04-15 02:58 UTC Modified: 2007-04-15 03:42 UTC
From: justinbrinkerhoff at gmail dot com Assigned:
Status: Not a bug Package: Feature/Change Request
PHP Version: 4.4.6 OS: Ubuntu 6.10 Edgy Eft
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: justinbrinkerhoff at gmail dot com
New email:
PHP Version: OS:

 

 [2007-04-15 02:58 UTC] justinbrinkerhoff at gmail dot com
Description:
------------
Hi, I ran accross something while writing an e-mail contact form for a customer. I have hosting provider still on PHP 4.3.2. I am changing providers soon though. But anyways, what I noticed is the mail() function only allows 5 arguments. 

So, what I wanted to ask/propose, is to see if perhaps I can suggest/request there be 7 - 10 arguments allowable in the mail() function. Five seems a bit limited, and I think a max of 10 would be reasonable. Beyond 10 would probably be a little rediculous, but 10 should suffice. 

I don't see this as necessarily a "bug" per say, but a feature that would make it a lot easier. 

Here is an example of the problem at hand.

Reproduce code:
---------------
//HTML Form Code - ContactUs.html
<form name="email" method="post" action="mail.php">
Name <input type="text" name="name" id="name" />
Address <input type="text" name="addr" id="addr" />
E-Mail <input type="text" name="from" id="from" />
Message <textarea rows="10" cols="20" name="notes" id="notes"></textarea>
<input type="submit" value="SEND" />
</form>

//PHP Code - mail.php
<?php
$date = date(r);
$to = "support@example.com";
$from = $_POST['from'];
$subject = "Example.com Support Inquiry - From Website";
$message = $_POST['notes'];
$address = $_POST['addr'];
if(mail($to, $date, $from, $subject, $message, $address)) {
echo "Message Sent";
} else {
echo "Message Failed";
}
?>

Expected result:
----------------
Page should say:

Message Sent

Actual result:
--------------
Warning: mail() expects at most 5 parameters, 6 given in /var/www/html/mail.php on line 8
Message Failed

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-04-15 03:42 UTC] scottmac@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

You don't need any extra parameters, you either change what is passed into the message parameter or into the additional_headers parameter as appropriate.
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Oct 15 20:00:01 2025 UTC