Skip to content

Instantly share code, notes, and snippets.

@somerongit
Created July 7, 2022 05:11
Show Gist options
  • Save somerongit/098c965a0d8d223678fff8970c67ace5 to your computer and use it in GitHub Desktop.
Save somerongit/098c965a0d8d223678fff8970c67ace5 to your computer and use it in GitHub Desktop.
import { createTransport } from "nodemailer";
async function sendMail( msg: string) {
var transporter = createTransport({
service: 'gmail',
auth: {
user: GetMailUserId(),
pass: GetMailPass()
}
});
var mailOptions = {
from: GetMailUserId(),
to: (await GetSupervisorMail()).toString(),
subject: 'Report',
text: msg
};
transporter.sendMail(mailOptions, function (error, info) {
if (error) {
console.error(" sendMail :: Unable to Send Mail to Supervisor \n" + error)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment