update email templates

This commit is contained in:
Emily
2025-04-11 18:16:14 +02:00
parent 475512711b
commit 1187cafd07
10 changed files with 290 additions and 121 deletions

View File

@@ -62,7 +62,7 @@ export class EmailService {
}
}
static async sendLimitEmail50(target: string, projectName: string) {
static async sendLimitEmail50(target: string) {
try {
const sendSmtpEmail = new SendSmtpEmail();
sendSmtpEmail.subject = "⚡ You've reached 50% limit on Litlyx";
@@ -70,7 +70,6 @@ export class EmailService {
sendSmtpEmail.to = [{ "email": target }];
sendSmtpEmail.htmlContent = TEMPLATE.LIMIT_50_EMAIL
.replace(/\[Project Name\]/, projectName)
.toString();
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
@@ -81,14 +80,13 @@ export class EmailService {
}
}
static async sendLimitEmail90(target: string, projectName: string) {
static async sendLimitEmail90(target: string) {
try {
const sendSmtpEmail = new SendSmtpEmail();
sendSmtpEmail.subject = "⚡ You've reached 90% limit on Litlyx";
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
sendSmtpEmail.to = [{ "email": target }];
sendSmtpEmail.htmlContent = TEMPLATE.LIMIT_90_EMAIL
.replace(/\[Project Name\]/, projectName)
.toString();
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
return true;
@@ -98,14 +96,13 @@ export class EmailService {
}
}
static async sendLimitEmailMax(target: string, projectName: string) {
static async sendLimitEmailMax(target: string) {
try {
const sendSmtpEmail = new SendSmtpEmail();
sendSmtpEmail.subject = "🚨 You've reached your limit on Litlyx!";
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
sendSmtpEmail.to = [{ "email": target }];
sendSmtpEmail.htmlContent = TEMPLATE.LIMIT_MAX_EMAIL
.replace(/\[Project Name\]/, projectName)
.toString();
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
return true;
@@ -130,14 +127,13 @@ export class EmailService {
}
}
static async sendPurchaseEmail(target: string, projectName: string) {
static async sendPurchaseEmail(target: string) {
try {
const sendSmtpEmail = new SendSmtpEmail();
sendSmtpEmail.subject = "Thank You for Upgrading Your Litlyx Plan!";
sendSmtpEmail.sender = { "name": "Litlyx", "email": "help@litlyx.com" };
sendSmtpEmail.to = [{ "email": target }];
sendSmtpEmail.htmlContent = TEMPLATE.PURCHASE_EMAIL
.replace(/\[Project Name\]/, projectName)
.toString();
await this.apiInstance.sendTransacEmail(sendSmtpEmail);
return true;

View File

@@ -90,10 +90,8 @@ app.post('/send/welcome', express.json(), async (req, res) => {
app.post('/send/purchase', express.json(), async (req, res) => {
try {
console.log('PURCHASE EMAIL DISABLED')
return;
const { target, projectName } = req.body;
const ok = await EmailService.sendPurchaseEmail(target, projectName);
const { target } = req.body;
const ok = await EmailService.sendPurchaseEmail(target);
res.json({ ok });
} catch (ex) {
res.status(500).json({ error: ex.message });
@@ -132,8 +130,8 @@ app.post('/send/anomaly/visits_events', express.json(), async (req, res) => {
app.post('/send/limit/50', express.json(), async (req, res) => {
try {
const { target, projectName } = req.body;
const ok = await EmailService.sendLimitEmail50(target, projectName);
const { target } = req.body;
const ok = await EmailService.sendLimitEmail50(target);
res.json({ ok });
} catch (ex) {
res.status(500).json({ error: ex.message });
@@ -142,8 +140,8 @@ app.post('/send/limit/50', express.json(), async (req, res) => {
app.post('/send/limit/90', express.json(), async (req, res) => {
try {
const { target, projectName } = req.body;
const ok = await EmailService.sendLimitEmail90(target, projectName);
const { target } = req.body;
const ok = await EmailService.sendLimitEmail90(target);
res.json({ ok });
} catch (ex) {
res.status(500).json({ error: ex.message });
@@ -152,8 +150,8 @@ app.post('/send/limit/90', express.json(), async (req, res) => {
app.post('/send/limit/max', express.json(), async (req, res) => {
try {
const { target, projectName } = req.body;
const ok = await EmailService.sendLimitEmailMax(target, projectName);
const { target } = req.body;
const ok = await EmailService.sendLimitEmailMax(target);
res.json({ ok });
} catch (ex) {
res.status(500).json({ error: ex.message });