php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #14799 Remove the "To:/Subject:" headers if not entered
Submitted: 2002-01-02 09:20 UTC Modified: 2002-01-14 05:30 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: miki at canaan dot co dot il Assigned:
Status: Not a bug Package: Mail related
PHP Version: 4.0.6 OS: RH 7.x
Private report: No CVE-ID: None
 [2002-01-02 09:20 UTC] miki at canaan dot co dot il
mail command accept:
mail ($recipient, $subject, $message [, string additional_headers]);
all good.

But when I construct all the mail from headers I don't need to supply: $recipient, $subject, $message as they all exist in the headers.

So I do:
mail ("", "", "", $headers);

The problem is that even when I write the "To:" header in the headers another empty "To:" appear next to it.

So for maximal flexibility I think that $headers suppose to override all other fields.

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-01-02 09:21 UTC] miki at canaan dot co dot il
oops, forgot to mention the bug type.
sorry
 [2002-01-02 11:07 UTC] miki at canaan dot co dot il
I also noticed and maybe im wrong that the mail function replace the "Return-path:" header that i inserted with Return-path:localuser@machine.com

if so this should be fixed too
 [2002-01-03 18:31 UTC] daniel@php.net
The strength of PHP is to give people functions which they can use, without understanding the mechanisms behind it. Why not just obsolete set_cookie() ? You could do this manually with header() (the code doesn't even get longer, you just have to pay attention how to format the cookie-parameters). 

yes, you could even obsolete mail() and leave it up to the user to either open a pipe to sendmail (un*x) or connect to an SMTP server (windows). 

there are dozens of core PHP functions which can be replaced by an equivalent piece of code IN PHP. but this "feature richness" just makes PHP so popular.

why tempnam()? you could write this very elegantly in PHP, too:

do {
  $tmp=substr(md5(microtime()),0,8);
}
while(file_exists($tmp));

I hope nobody disagrees with setting this to "bogus".

Kind Regards,
  Daniel Lorch
 [2002-01-14 05:30 UTC] miki at canaan dot co dot il
The "Return-path" is set by sendmail and not PHP, so there is no need to fix this as it not concerned to PHP at all.

So to fix the mail() properly the php team need to enable the headers to control everything like the "To:" header

Regarding Daniel opinion I don't think that mail() should be canceled and everything should pipe to sendmail.

Less code is much more easy to handle, and the code will be easier to transfer from one server to other.

to make the code perfect imho the "To:" & the "Subject:" headers should not be mandatory as the first/second argument in the mail() function.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 00:01:29 2024 UTC