budibase/packages/worker/src/utilities/email.js

22 lines
477 B
JavaScript
Raw Normal View History

const nodemailer = require("nodemailer")
exports.createSMTPTransport = config => {
const options = {
port: config.port,
host: config.host,
secure: config.secure || false,
auth: config.auth,
}
if (config.selfSigned) {
options.tls = {
rejectUnauthorized: false,
}
}
return nodemailer.createTransport(options)
}
exports.verifyConfig = async config => {
const transport = exports.createSMTPTransport(config)
await transport.verify()
}