mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 12:17:37 +00:00
feat: include screenshot for emails + sms notifications (#144)
This commit is contained in:
+11
-1
@@ -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 subject = 'NVIDIA - BUY NOW';
|
||||
const [email, phone] = [Config.notifications.email, Config.notifications.phone];
|
||||
@@ -20,9 +21,18 @@ const mailOptions: Mail.Options = {
|
||||
subject
|
||||
};
|
||||
|
||||
export function sendSMS(text: string) {
|
||||
export function sendSMS(text: string, link: Link) {
|
||||
mailOptions.text = text;
|
||||
|
||||
if (link.screenshot) {
|
||||
mailOptions.attachments = [
|
||||
{
|
||||
filename: link.screenshot,
|
||||
path: `./${link.screenshot}`
|
||||
}
|
||||
];
|
||||
}
|
||||
|
||||
transporter.sendMail(mailOptions, (error, info) => {
|
||||
if (error) {
|
||||
Logger.error(error);
|
||||
|
||||
Reference in New Issue
Block a user