Built motion from commit 4143fce.|0.0.15
[motion.git] / server / config / smtp / index.js
1 'use strict';
2
3 var _ = require('lodash');
4 var MailServerOut = require('../../models').MailServerOut;
5
6 module.exports = {
7   init: function () {
8
9     MailServerOut.afterCreate(function (doc) {
10       require('./smtp').create(doc);
11     });
12
13     return MailServerOut
14       .findAll()
15       .then(function (data) {
16         data.forEach(function (elm) {
17           require('./smtp').create(elm);
18         });
19       })
20       .catch(function (err) {
21         console.error(err);
22       });
23   }
24 };