Commit 50639309 authored by Jens-Christian Fischer's avatar Jens-Christian Fischer
Browse files

Add 'mail_from_address' configuration

In environments where there are rules for the email addresses, the "from
address" that owncloud uses has to be configurable.

This patch adds a new configuration variable 'mail_from_address'.
If it is configured, owncloud will use this as the sender of *all*
emails. (OwnCloud uses 'sharing-noreply' and 'password-noreply' by
default). By using the 'mail_from_address' configuration, only this
email address will be used.
parent 9fa788c4
......@@ -256,6 +256,7 @@ class Util {
* it would return ''
public static function getDefaultEmailAddress($user_part) {
$user_part = \OC_Config::getValue('mail_from_address', $user_part);
$host_name = self::getServerHostName();
$host_name = \OC_Config::getValue('mail_domain', $host_name);
$defaultEmailAddress = $user_part.'@'.$host_name;
......@@ -88,6 +88,15 @@ class Test_Util extends PHPUnit_Framework_TestCase {
function testGetConfiguredEmailAddressFromConfig() {
OC_Config::setValue('mail_domain', '');
OC_Config::setValue('mail_from_address', 'owncloud');
$email = \OCP\Util::getDefaultEmailAddress("no-reply");
$this->assertEquals('', $email);
function testGetInstanceIdGeneratesValidId() {
$this->assertStringStartsWith('oc', OC_Util::getInstanceId());
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment