mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 12:17:37 +00:00
8c5d7d0c49
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
35 lines
768 B
TypeScript
35 lines
768 B
TypeScript
import nodemailer from 'nodemailer';
|
|
import Mail from 'nodemailer/lib/mailer';
|
|
import {Config} from '../config';
|
|
import {Logger} from '../logger';
|
|
|
|
const email = Config.notifications.email;
|
|
const subject = 'NVIDIA - BUY NOW';
|
|
|
|
const transporter = nodemailer.createTransport({
|
|
service: 'gmail',
|
|
auth: {
|
|
user: email.username,
|
|
pass: email.password
|
|
}
|
|
});
|
|
|
|
const mailOptions: Mail.Options = {
|
|
from: email.username,
|
|
to: email.username,
|
|
subject
|
|
};
|
|
|
|
export function sendEmail(text: string) {
|
|
mailOptions.text = text;
|
|
|
|
transporter.sendMail(mailOptions, (error, info) => {
|
|
if (error) {
|
|
Logger.error(error);
|
|
} else {
|
|
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
|
Logger.info(`✔ email sent: ${info.response}`);
|
|
}
|
|
});
|
|
}
|