+ Renamed the mail model and worked some more on it
This commit is contained in:
parent
a9ef1b64ee
commit
41a20438bc
|
@ -0,0 +1,39 @@
|
|||
import {getConfig} from "../helper/config";
|
||||
import nodemailer from "nodemailer";
|
||||
|
||||
const config = getConfig();
|
||||
|
||||
/**
|
||||
* Get the instance of the transporter
|
||||
* @returns A transporter instance for sending out emails
|
||||
*/
|
||||
function getTransporter() : nodemailer.Transporter {
|
||||
|
||||
// Generate the transporter
|
||||
const transporter = nodemailer.createTransport({
|
||||
host: config?.smtp.host,
|
||||
auth: {
|
||||
user: config?.smtp.username,
|
||||
pass: config?.smtp.password,
|
||||
}
|
||||
});
|
||||
|
||||
// Return the transporter
|
||||
return transporter;
|
||||
}
|
||||
|
||||
export async function sendMail(mailContent: string, toAddress: string, ccAddresses?: Array<string>) {
|
||||
|
||||
// Get the transporter
|
||||
const transporter = getTransporter();
|
||||
|
||||
await new Promise((_r, _e) => {
|
||||
transporter.sendMail({
|
||||
|
||||
}, (err, info) => {
|
||||
|
||||
})
|
||||
})
|
||||
|
||||
transporter.close();
|
||||
}
|
|
@ -1,9 +0,0 @@
|
|||
import nodemailer from "nodemailer";
|
||||
|
||||
function getTransporter() {
|
||||
|
||||
}
|
||||
|
||||
export function sendMail(mailContent: string, toAddress: string, ccAddresses?: Array<string>) {
|
||||
|
||||
}
|
Reference in New Issue