mail: add a Return-Path header is done on the first line and the other headers are added at the end of the headers
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3759 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
28
mail.php
28
mail.php
@@ -1119,9 +1119,31 @@ class mail
|
||||
throw new \Exception ("Wanted section not found in addHeader", 404);
|
||||
$sectionMainID = $sectionID;
|
||||
}
|
||||
$this->sections[$sectionMainID]["_headersArray"][][$header] = $value;
|
||||
// TODO : Encode ? Strip ?
|
||||
$this->sections[$sectionMainID]["_headersEML"] .= "$header: $value";
|
||||
if ($header === "Return-Path")
|
||||
{
|
||||
// Must be placed on the first line and must be unique
|
||||
reset ($this->sections[$sectionMainID]["_headersArray"]);
|
||||
if (key_exists (0, $this->sections[$sectionMainID]["_headersArray"]) &&
|
||||
key_exists ("Return-Path", $this->sections[$sectionMainID]["_headersArray"][0]))
|
||||
{
|
||||
// Remove the old one
|
||||
array_shift ($this->sections[$sectionMainID]["_headersArray"]);
|
||||
$this->sections[$sectionMainID]["_headersEML"] =
|
||||
substr ($this->sections[$sectionMainID]["_headersEML"],
|
||||
strpos ($this->sections[$sectionMainID]["_headersEML"], "\n") +1);
|
||||
}
|
||||
array_unshift ($this->sections[$sectionMainID]["_headersArray"],
|
||||
array ($header => $value));
|
||||
$this->sections[$sectionMainID]["_headersEML"] = "$header: $value".
|
||||
$this->sections[$sectionMainID]["_headersEML"];
|
||||
}
|
||||
else
|
||||
{
|
||||
// The "normal" headers are places sequentially at the end of the headers
|
||||
$this->sections[$sectionMainID]["_headersArray"][][$header] = $value;
|
||||
// TODO : Encode ? Strip ?
|
||||
$this->sections[$sectionMainID]["_headersEML"] .= "$header: $value";
|
||||
}
|
||||
$this->createMailEML ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user