feat: include screenshot for emails + sms notifications (#144)

This commit is contained in:
Jordan Garcia
2020-09-20 20:42:20 -04:00
committed by GitHub
parent 0f6e570cc8
commit 7191e03a80
5 changed files with 27 additions and 5 deletions
+11 -1
View File
@@ -2,6 +2,7 @@ import nodemailer from 'nodemailer';
import Mail from 'nodemailer/lib/mailer';
import {Config} from '../config';
import {Logger} from '../logger';
import {Link} from '../store/model';
const email = Config.notifications.email;
const subject = 'NVIDIA - BUY NOW';
@@ -20,9 +21,18 @@ const mailOptions: Mail.Options = {
subject
};
export function sendEmail(cartUrl: string) {
export function sendEmail(cartUrl: string, link: Link) {
mailOptions.text = cartUrl;
if (link.screenshot) {
mailOptions.attachments = [
{
filename: link.screenshot,
path: `./${link.screenshot}`
}
];
}
transporter.sendMail(mailOptions, (error, info) => {
if (error) {
Logger.error(error);