1
0
Fork 0

Move "App::getSenderEmailAddress()" to "Emailer::getSiteEmailAddress()"

This commit is contained in:
nupplaPhil 2020-02-01 23:32:03 +01:00
commit 0e13428210
No known key found for this signature in database
GPG key ID: D8365C3D36B77D90
5 changed files with 45 additions and 41 deletions

View file

@ -29,25 +29,62 @@ class Emailer
/** @var App\BaseURL */
private $baseUrl;
/** @var string */
private $siteEmailAddress;
/** @var string */
private $siteEmailName;
public function __construct(IConfig $config, IPConfig $pConfig, App\BaseURL $baseURL, LoggerInterface $logger)
{
$this->config = $config;
$this->pConfig = $pConfig;
$this->logger = $logger;
$this->baseUrl = $baseURL;
$this->siteEmailAddress = $this->config->get('config', 'sender_email');
if (empty($sysEmailAddress)) {
$hostname = $this->baseUrl->getHostname();
if (strpos($hostname, ':')) {
$hostname = substr($hostname, 0, strpos($hostname, ':'));
}
$this->siteEmailAddress = 'noreply@' . $hostname;
}
$this->siteEmailName = $this->config->get('config', 'sitename', 'Friendica Social Network');
}
/**
* Gets the site's default sender email address
*
* @return string
*/
public function getSiteEmailAddress()
{
return $this->siteEmailAddress;
}
/**
* Gets the site's default sender name
*
* @return string
*/
public function getSiteEmailName()
{
return $this->siteEmailName;
}
/**
* Creates a new system email
*
* @param App $a The Friendica app
* @param L10n $l10n The chosen language for the new email
*
* @return SystemMailBuilder
*/
public function newSystemMail(App $a, L10n $l10n)
public function newSystemMail(L10n $l10n)
{
return new SystemMailBuilder($a, $l10n, $this->baseUrl, $this->config);
return new SystemMailBuilder($l10n, $this->baseUrl, $this->config,
$this->getSiteEmailAddress(), $this->getSiteEmailName());
}
/**