Improved from email address format for notifications.
This commit is contained in:
parent
ae48f24406
commit
46441106d1
|
@ -25,7 +25,7 @@ php-censor:
|
||||||
per_page: 10
|
per_page: 10
|
||||||
url: 'http://php-censor.local'
|
url: 'http://php-censor.local'
|
||||||
email_settings:
|
email_settings:
|
||||||
from_address: 'no-reply@php-censor.local'
|
from_address: 'PHP Censor <no-reply@php-censor.local>'
|
||||||
smtp_address: null
|
smtp_address: null
|
||||||
smtp_port: null
|
smtp_port: null
|
||||||
smtp_username: null
|
smtp_username: null
|
||||||
|
|
|
@ -254,7 +254,7 @@ class InstallCommand extends Command
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'queue' => $queueConfig,
|
'queue' => $queueConfig,
|
||||||
'email_settings' => [
|
'email_settings' => [
|
||||||
'from_address' => 'no-reply@php-censor.local',
|
'from_address' => 'PHP Censor <no-reply@php-censor.local>',
|
||||||
'smtp_address' => null,
|
'smtp_address' => null,
|
||||||
'smtp_port' => null,
|
'smtp_port' => null,
|
||||||
'smtp_username' => null,
|
'smtp_username' => null,
|
||||||
|
|
|
@ -95,13 +95,18 @@ class Email
|
||||||
*/
|
*/
|
||||||
protected function getFrom()
|
protected function getFrom()
|
||||||
{
|
{
|
||||||
$email = $this->config->get('php-censor.email_settings.from_address', self::DEFAULT_FROM);
|
$from = $this->config->get(
|
||||||
|
'php-censor.email_settings.from_address',
|
||||||
if (empty($email)) {
|
self::DEFAULT_FROM
|
||||||
$email = self::DEFAULT_FROM;
|
);
|
||||||
|
|
||||||
|
if (strpos($from, '<') === false) {
|
||||||
|
return (string)$from;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $email;
|
preg_match('#^(.*?)<(.*)>$#ui', $from, $fromParts);
|
||||||
|
|
||||||
|
return [$fromParts[2] => $fromParts[1]];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue