mirror of
https://github.com/friendica/friendica
synced 2025-04-24 03:50:12 +00:00
Transform email header string to header array & replace it at various situations.
This commit is contained in:
parent
766d92aaa0
commit
ac1d2cf38f
7 changed files with 75 additions and 28 deletions
|
@ -83,11 +83,18 @@ interface IEmail extends JsonSerializable
|
|||
function getMessage(bool $plain = false);
|
||||
|
||||
/**
|
||||
* Gets any additional mail header
|
||||
* Gets the additional mail header array
|
||||
*
|
||||
* @return string[][]
|
||||
*/
|
||||
function getAdditionalMailHeader();
|
||||
|
||||
/**
|
||||
* Gets the additional mail header as string - EOL separated
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function getAdditionalMailHeader();
|
||||
function getAdditionalMailHeaderString();
|
||||
|
||||
/**
|
||||
* Returns the current email with a new recipient
|
||||
|
|
|
@ -47,14 +47,14 @@ class Email implements IEmail
|
|||
/** @var string */
|
||||
private $msgText;
|
||||
|
||||
/** @var string */
|
||||
private $additionalMailHeader = '';
|
||||
/** @var string[][] */
|
||||
private $additionalMailHeader;
|
||||
/** @var int|null */
|
||||
private $toUid = null;
|
||||
private $toUid;
|
||||
|
||||
public function __construct(string $fromName, string $fromAddress, string $replyTo, string $toAddress,
|
||||
string $subject, string $msgHtml, string $msgText,
|
||||
string $additionalMailHeader = '', int $toUid = null)
|
||||
array $additionalMailHeader = [], int $toUid = null)
|
||||
{
|
||||
$this->fromName = $fromName;
|
||||
$this->fromAddress = $fromAddress;
|
||||
|
@ -127,6 +127,25 @@ class Email implements IEmail
|
|||
return $this->additionalMailHeader;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public function getAdditionalMailHeaderString()
|
||||
{
|
||||
$headerString = '';
|
||||
|
||||
foreach ($this->additionalMailHeader as $name => $values) {
|
||||
if (is_array($values)) {
|
||||
foreach ($values as $value) {
|
||||
$headerString .= $name . ': ' . $value . '\n';
|
||||
}
|
||||
} else {
|
||||
$headerString .= $name . ': ' . $values . '\n';
|
||||
}
|
||||
}
|
||||
return $headerString;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue