Extract System emails from enotify

- Removed every SYSTEM_EMAIL occurrence in enotify
- Introduced a "SystemMailBuilder" for build system emails
- Replaced every SYSTEM_EMAIL usage in the classes with calling this builder
- Added tests for this new Builder
- Split the email templates between "base" template for email and concrete usages for different use cases
This commit is contained in:
nupplaPhil 2020-02-01 20:08:54 +01:00
parent 74490d6594
commit 3291728059
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
18 changed files with 647 additions and 118 deletions

View file

@ -7,10 +7,12 @@ namespace Friendica\Util;
use Friendica\App;
use Friendica\Core\Config\IConfig;
use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\PConfig\IPConfig;
use Friendica\Network\HTTPException\InternalServerErrorException;
use Friendica\Object\EMail\IEmail;
use Friendica\Protocol\Email;
use Friendica\Util\EMailer\SystemMailBuilder;
use Psr\Log\LoggerInterface;
/**
@ -35,6 +37,18 @@ class Emailer
$this->baseUrl = $baseURL;
}
/**
* Creates a new system email
*
* @param L10n $l10n The chosen language for the new email
*
* @return SystemMailBuilder
*/
public function newSystemMail(L10n $l10n)
{
return new SystemMailBuilder($l10n, $this->baseUrl, $this->config);
}
/**
* Send a multipart/alternative message with Text and HTML versions
*