Skip to content
Snippets Groups Projects
Commit 6c304fa5 authored by Thomas Müller's avatar Thomas Müller
Browse files

validate the generated email address and fall back to localhost.localdomain in case it is not valid

fixes #1844
parent 5036e316
No related branches found
No related tags found
No related merge requests found
......@@ -217,11 +217,14 @@ class Util {
*/
public static function getDefaultEmailAddress($user_part) {
$host_name = self::getServerHostName();
// handle localhost installations
if ($host_name === 'localhost') {
$host_name = "example.com";
$defaultEmailAddress = $user_part.'@'.$host_name;
if (\PHPMailer::ValidateAddress($defaultEmailAddress)) {
return $defaultEmailAddress;
}
return $user_part.'@'.$host_name;
// incase we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain'
return $user_part.'@localhost.localdomain';
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment