mirror of
https://github.com/moparisthebest/mail
synced 2024-08-13 16:43:47 -04:00
cf1f60fbf9
* add spinners to all login pages * use inline error messages in all form instead of scope.onError * create newsletter service
27 lines
674 B
JavaScript
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;
|
|
});
|
|
}; |