Merge pull request #2016 from owncloud/fixing-1844-master

validate the generated email address and fall back to localhost.localdom...
This commit is contained in:
Lukas Reschke 2013-03-01 14:00:30 -08:00
commit 31754a653b
1 changed files with 7 additions and 4 deletions

View File

@ -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';
}
/**