diff --git a/docs/en/configuring.md b/docs/en/configuring.md index 7d2457e4..1dbc5767 100644 --- a/docs/en/configuring.md +++ b/docs/en/configuring.md @@ -25,7 +25,7 @@ php-censor: per_page: 10 url: 'http://php-censor.local' email_settings: - from_address: 'no-reply@php-censor.local' + from_address: 'PHP Censor ' smtp_address: null smtp_port: null smtp_username: null diff --git a/src/PHPCensor/Command/InstallCommand.php b/src/PHPCensor/Command/InstallCommand.php index 186fe74b..cfa1f509 100644 --- a/src/PHPCensor/Command/InstallCommand.php +++ b/src/PHPCensor/Command/InstallCommand.php @@ -254,7 +254,7 @@ class InstallCommand extends Command 'url' => $url, 'queue' => $queueConfig, 'email_settings' => [ - 'from_address' => 'no-reply@php-censor.local', + 'from_address' => 'PHP Censor ', 'smtp_address' => null, 'smtp_port' => null, 'smtp_username' => null, diff --git a/src/PHPCensor/Helper/Email.php b/src/PHPCensor/Helper/Email.php index 63afafcd..6f7ccc01 100644 --- a/src/PHPCensor/Helper/Email.php +++ b/src/PHPCensor/Helper/Email.php @@ -95,13 +95,18 @@ class Email */ protected function getFrom() { - $email = $this->config->get('php-censor.email_settings.from_address', self::DEFAULT_FROM); - - if (empty($email)) { - $email = self::DEFAULT_FROM; + $from = $this->config->get( + 'php-censor.email_settings.from_address', + self::DEFAULT_FROM + ); + + if (strpos($from, '<') === false) { + return (string)$from; } - - return $email; + + preg_match('#^(.*?)<(.*)>$#ui', $from, $fromParts); + + return [$fromParts[2] => $fromParts[1]]; } /**