mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 13:27:38 +00:00
feat: use ts, update cd, update README (#12)
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
import nodemailer from 'nodemailer';
|
||||
import Mail from 'nodemailer/lib/mailer';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
|
||||
const subject = 'NVIDIA - BUY NOW';
|
||||
|
||||
const transporter = nodemailer.createTransport({
|
||||
service: 'gmail',
|
||||
auth: {
|
||||
user: Config.email.username,
|
||||
pass: Config.email.password
|
||||
}
|
||||
});
|
||||
|
||||
const mailOptions: Mail.Options = {
|
||||
from: Config.email.username,
|
||||
to: Config.email.username,
|
||||
subject
|
||||
};
|
||||
|
||||
export default 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}`);
|
||||
}
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user