UNPKG

ckn.communication

Version:

42 lines (38 loc) 1.08 kB
import { ckn } from 'ckn'; import { CommunicationConnector } from './connector.js'; const nodemailer = await import('nodemailer'); class CKNMailClient extends CommunicationConnector { constructor() { super(); this.user = ""; this.password = ""; this.host = ""; this.port = 587; this.secure = false; } send = (emailForm, emailTo, subject, message) => { var transporter = nodemailer.createTransport({ host: this.host, port: this.port, secure: this.secure, auth: { user: this.user, pass: this.password } }); var mailOptions = { from: emailForm, to: emailTo.toText(", "), subject: subject, html: message }; transporter.sendMail(mailOptions, function(error, info){ if (error) { console.log(error); } else { console.log('Email sent: ' + info.response); } }); }; } export { CKNMailClient }