diff options
author | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 02:50:11 -0700 |
---|---|---|
committer | Bernhard Posselt <nukeawhale@gmail.com> | 2013-03-26 02:50:11 -0700 |
commit | d49e8ffb5ed4be03f05b607d9b673e4543b94d21 (patch) | |
tree | cfa977851bc941f18becc0d876c161fdd116f062 | |
parent | d121180d46009dec1464d73bb0f769b0b62a00d9 (diff) | |
parent | f0733b2cb53cc199d0bb7667b23dbdced449ac88 (diff) | |
download | nextcloud-server-d49e8ffb5ed4be03f05b607d9b673e4543b94d21.tar.gz nextcloud-server-d49e8ffb5ed4be03f05b607d9b673e4543b94d21.zip |
Merge pull request #2568 from itheiss/master
Implement setting custom domainname for getDefaultEmailAddress
-rw-r--r-- | config/config.sample.php | 3 | ||||
-rw-r--r-- | lib/public/util.php | 1 | ||||
-rw-r--r-- | tests/lib/util.php | 9 |
3 files changed, 12 insertions, 1 deletions
diff --git a/config/config.sample.php b/config/config.sample.php index ec61ceefd6c..995a02f6d94 100644 --- a/config/config.sample.php +++ b/config/config.sample.php @@ -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, diff --git a/lib/public/util.php b/lib/public/util.php index db07cbcfff3..6744c2d37bd 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -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)) { diff --git a/tests/lib/util.php b/tests/lib/util.php index b904c359807..1c9054264c9 100644 --- a/tests/lib/util.php +++ b/tests/lib/util.php @@ -47,4 +47,11 @@ class Test_Util extends PHPUnit_Framework_TestCase { $email = \OCP\Util::getDefaultEmailAddress("no-reply"); $this->assertEquals('no-reply@localhost.localdomain', $email); } -}
\ No newline at end of file + + 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'); + } +} |