Merge pull request #2568 from itheiss/master
Implement setting custom domainname for getDefaultEmailAddress
This commit is contained in:
commit
d49e8ffb5e
3 changed files with 12 additions and 1 deletions
|
@ -77,6 +77,9 @@ $CONFIG = array(
|
|||
/* URL of the appstore to use, server should understand OCS */
|
||||
"appstoreurl" => "http://api.apps.owncloud.com/v1",
|
||||
|
||||
/* Domain name used by ownCloud for the sender mail address, e.g. no-reply@example.com */
|
||||
"mail_domain" => "example.com",
|
||||
|
||||
/* Enable SMTP class debugging */
|
||||
"mail_smtpdebug" => false,
|
||||
|
||||
|
|
|
@ -217,6 +217,7 @@ class Util {
|
|||
*/
|
||||
public static function getDefaultEmailAddress($user_part) {
|
||||
$host_name = self::getServerHostName();
|
||||
$host_name = \OC_Config::getValue('mail_domain', $host_name);
|
||||
$defaultEmailAddress = $user_part.'@'.$host_name;
|
||||
|
||||
if (\OC_Mail::ValidateAddress($defaultEmailAddress)) {
|
||||
|
|
|
@ -47,4 +47,11 @@ class Test_Util extends PHPUnit_Framework_TestCase {
|
|||
$email = \OCP\Util::getDefaultEmailAddress("no-reply");
|
||||
$this->assertEquals('no-reply@localhost.localdomain', $email);
|
||||
}
|
||||
}
|
||||
|
||||
function testGetDefaultEmailAddressFromConfig() {
|
||||
OC_Config::setValue('mail_domain', 'example.com');
|
||||
$email = \OCP\Util::getDefaultEmailAddress("no-reply");
|
||||
$this->assertEquals('no-reply@example.com', $email);
|
||||
OC_Config::deleteKey('mail_domain');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue