/** * @brief Returns the default email address * @param string $user_part the user part of the address * @returns string the default email address * * Assembles a default email address (using the server hostname * and the given user part, and returns it * Example: when given lostpassword-noreply as $user_part param, * and is currently accessed via http(s)://example.com/, * it would return '*****@*****.**' */ public static function getDefaultEmailAddress($user_part) { $host_name = self::getServerHostName(); $defaultEmailAddress = $user_part . '@' . $host_name; if (\OC_Mail::ValidateAddress($defaultEmailAddress)) { return $defaultEmailAddress; } // in case we cannot build a valid email address from the hostname let's fallback to 'localhost.localdomain' return $user_part . '@localhost.localdomain'; }