aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Reschke <lukas@statuscode.ch>2013-03-01 14:00:30 -0800
committerLukas Reschke <lukas@statuscode.ch>2013-03-01 14:00:30 -0800
commit31754a653b13fdf31273177f12c39e32cb8c4001 (patch)
tree19e246b448555b5982f6cc627abe47664f810c2f
parent5036e316a6bc1a00c95c49e62da9a800dc0e89d5 (diff)
parent6c304fa5c0864dd882415b701dc24e6fd9249daa (diff)
downloadnextcloud-server-31754a653b13fdf31273177f12c39e32cb8c4001.tar.gz
nextcloud-server-31754a653b13fdf31273177f12c39e32cb8c4001.zip
Merge pull request #2016 from owncloud/fixing-1844-master
validate the generated email address and fall back to localhost.localdom...
-rw-r--r--lib/public/util.php11
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/public/util.php b/lib/public/util.php
index 13498b260ef..5d814114a24 100644
--- a/lib/public/util.php
+++ b/lib/public/util.php
@@ -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';
}
/**