瀏覽代碼

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

fixes #1844
tags/v5.0.0RC2
Thomas Mueller 11 年之前
父節點
當前提交
6c304fa5c0
共有 1 個檔案被更改,包括 7 行新增4 行删除
  1. 7
    4
      lib/public/util.php

+ 7
- 4
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';
}

/**

Loading…
取消
儲存