first commit backend

This commit is contained in:
lesion
2019-02-26 00:02:42 +01:00
commit 887157f2a9
27 changed files with 819 additions and 0 deletions

34
app/mail.js Normal file
View File

@@ -0,0 +1,34 @@
const Email = require('email-templates')
const path = require('path')
const config = require('./config');
const mail = {
send (addresses, template, locals) {
locals.locale = config.locale
const email = new Email({
juice: true,
juiceResources: {
preserveImportant: true,
webResources: {
relativeTo: path.join(__dirname, '..', 'emails')
}
},
message: {
from: 'Gancio <eventi@cisti.org>'
},
send: true,
i18n: {},
transport: config.smtp
})
return email.send({
template,
message: {
to: addresses,
bcc: config.admin
},
locals
})
}
}
module.exports = mail