mirror of
https://framagit.org/les/gancio.git
synced 2025-02-01 00:52:01 +01:00
34 lines
721 B
JavaScript
34 lines
721 B
JavaScript
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: `${config.title} <${config.smtp.auth.user}>`
|
|
},
|
|
send: true,
|
|
i18n: {},
|
|
transport: config.smtp
|
|
})
|
|
return email.send({
|
|
template,
|
|
message: {
|
|
to: addresses,
|
|
bcc: config.admin
|
|
},
|
|
locals
|
|
})
|
|
}
|
|
}
|
|
|
|
module.exports = mail
|