diff --git a/src/views/email.html b/src/views/email.html
index 211f6b3d0..5565d81c4 100644
--- a/src/views/email.html
+++ b/src/views/email.html
@@ -16,6 +16,8 @@
If this domain is already configured to handle email with some other provider, it will overwrite those records.
+
+
Any installed webmail clients will be automatically re-configured to reflect this change.
- This will disable the Cloudron Email Server for {{selectedDomain.domain}}.
+
This will disable the Cloudron Email Server for {{selectedDomain.domain}}.
+
+
Any installed webmail clients will be automatically re-configured to reflect this change.
diff --git a/src/views/email.js b/src/views/email.js
index 625e7c1fd..eae490c5a 100644
--- a/src/views/email.js
+++ b/src/views/email.js
@@ -206,6 +206,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
Client.enableMailForDomain($scope.selectedDomain.domain, true , function (error) {
if (error) return console.error(error);
+ $scope.reconfigureEmailApps();
+
Client.setDnsRecords($scope.selectedDomain.domain, function (error) {
if (error) return console.error(error);
@@ -223,6 +225,8 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
Client.enableMailForDomain($scope.selectedDomain.domain, false , function (error) {
if (error) return console.error(error);
+
+ $scope.reconfigureEmailApps();
$scope.refreshDomain();
$scope.incomingEmail.busy = false;
});
@@ -525,6 +529,18 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio
$location.path('/email/' + $scope.selectedDomain.domain, false);
};
+ // this is required because we need to rewrite the MAIL_DOMAINS env var
+ $scope.reconfigureEmailApps = function () {
+ var installedApps = Client.getInstalledApps();
+ for (var i = 0; i < installedApps.length; i++) {
+ if (!installedApps[i].manifest.addons.email) continue;
+
+ Client.configureApp(installedApps[i].id, { }, function (error) {
+ if (error) console.error(error);
+ });
+ }
+ };
+
$scope.refreshDomain = function () {
$scope.refreshBusy = true;