diff --git a/src/js/client.js b/src/js/client.js index 4fe0f0687..b5b226f8a 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -2215,6 +2215,15 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; + Client.prototype.setMailBanner = function (domain, data, callback) { + post('/api/v1/mail/' + domain + '/banner', data, null, function (error, data, status) { + if (error) return callback(error); + if (status !== 202) return callback(new ClientError(status, data)); + + callback(null); + }); + }; + Client.prototype.setCatchallAddresses = function (domain, addresses, callback) { post('/api/v1/mail/' + domain + '/catch_all', { addresses: addresses }, null, function (error, data, status) { if (error) return callback(error); diff --git a/src/views/email.html b/src/views/email.html index 15e383656..93a9a0f6e 100644 --- a/src/views/email.html +++ b/src/views/email.html @@ -608,6 +608,44 @@ + +
+

Signature

+

The text here will be attached to all emails going out from this domain.

+ +
+
+ This feature is only available in the paid plans. Setup Subscription Now +
+
+ +
+
+
+
+
+ + +
+ +
+ + +
+ + +
+
+
+
+
+
+ +
+
+
diff --git a/src/views/email.js b/src/views/email.js index 3a24601d7..c32e3fff8 100644 --- a/src/views/email.js +++ b/src/views/email.js @@ -238,6 +238,29 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio } }; + $scope.banner = { + busy: false, + text: '', + html: '', + + submit: function () { + $scope.banner.busy = true; + + Client.setMailBanner($scope.domain.domain, { text: $scope.banner.text, html: $scope.banner.html }, function (error) { + if (error) { + $scope.banner.busy = false; + return console.error(error); + } + + // give sometime for the mail container to restart + $timeout(function () { + $scope.banner.busy = false; + $scope.refreshDomain(); + }, 5000); + }); + } + }; + $scope.incomingEmail = { busy: false, setupDns: true, @@ -525,6 +548,17 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio busy: false, preset: $scope.mailRelayPresets[0], + // form data to be set on load + relay: { + provider: 'cloudron-smtp', + host: '', + port: 25, + username: '', + password: '', + serverApiToken: '', + acceptSelfSignedCerts: false + }, + presetChanged: function () { $scope.mailRelay.error = null; @@ -537,17 +571,6 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio $scope.mailRelay.relay.acceptSelfSignedCerts = false; }, - // form data to be set on load - relay: { - provider: 'cloudron-smtp', - host: '', - port: 25, - username: '', - password: '', - serverApiToken: '', - acceptSelfSignedCerts: false - }, - submit: function () { $scope.mailRelay.error = null; $scope.mailRelay.busy = true; @@ -685,6 +708,9 @@ angular.module('Application').controller('EmailController', ['$scope', '$locatio } } + $scope.banner.text = mailConfig.banner.text || ''; + $scope.banner.html = mailConfig.banner.html || ''; + // amend to selected domain to be available for the UI $scope.domain.mailConfig = mailConfig; $scope.domain.mailStatus = {};