1
0
mirror of https://github.com/moparisthebest/mail synced 2024-08-13 16:43:47 -04:00
mail/src/js/service/mail-config.js
Tankred Hase cf1f60fbf9 [WO-649] clean up login pages
* add spinners to all login pages
* use inline error messages in all form instead of scope.onError
* create newsletter service
2014-11-12 16:12:26 +01:00

27 lines
674 B
JavaScript

'use strict';
var ngModule = angular.module('woServices');
ngModule.service('mailConfig', MailConfig);
var cfg = require('../app-config').config;
function MailConfig($http, $q) {
this._http = $http;
this._q = $q;
}
/**
* Get the mail server IMAP and SMTP configuration for an email address
*/
MailConfig.prototype.get = function(emailAddress) {
if (emailAddress.indexOf('@') < 0) {
return this._q(function(resolve, reject) {
reject(new Error('Invalid email address!'));
});
}
var url = cfg.settingsUrl + emailAddress.split('@')[1];
return this._http.get(url).then(function(res) {
return res.data;
});
};