Merge pull request #9255 from MrPetovan/bug/fatal-errors

Add expected method MailBuilder->withHeaders
This commit is contained in:
Michael Vogel 2020-09-21 19:03:57 +02:00 committed by GitHub
commit 9c7a4ae2bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 3 deletions

View File

@ -550,13 +550,13 @@ function notification($params)
'title' => $title, 'title' => $title,
'body' => $body, 'body' => $body,
'subject' => $subject, 'subject' => $subject,
'headers' => $emailBuilder->getHeaders(),
]; ];
Hook::callAll('enotify_mail', $datarray); Hook::callAll('enotify_mail', $datarray);
$builder = DI::emailer() $emailBuilder
->newNotifyMail() ->withHeaders($datarray['headers'])
->addHeaders($datarray['headers'])
->withRecipient($params['to_email']) ->withRecipient($params['to_email'])
->forUser([ ->forUser([
'uid' => $datarray['uid'], 'uid' => $datarray['uid'],

View File

@ -159,6 +159,36 @@ abstract class MailBuilder
return $this; return $this;
} }
/**
* Returns the current headers
*
* @return string[][]
*/
public function getHeaders()
{
return $this->headers;
}
/**
* Sets the headers
*
* Expected format is
* [
* 'Header1' => ['value1', 'value2', ...],
* 'Header2' => ['value3', 'value4', ...],
* ...
* ]
*
* @param string[][] $headers
* @return $this
*/
public function withHeaders(array $headers)
{
$this->headers = $headers;
return $this;
}
/** /**
* Adds a value to a header * Adds a value to a header
* *