You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
CoreID/app/unit/SMTPUnit.js

30 lines
646 B

const { Unit } = require('libflitter')
const nodemailer = require('nodemailer')
class SMTPUnit extends Unit {
static get name() { return 'smtp' }
static get services() {
return [...super.services, 'configs']
}
config() {
return this.configs.get('smtp')
}
transport() {
return this._transport
}
async go(app) {
const config = this.config()
this._transport = nodemailer.createTransport({
host: config.host,
port: config.port,
secure: config.secure,
auth: config.auth,
})
}
}
module.exports = exports = SMTPUnit