Add click and open tracking
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { EmailContent } from "~/types";
|
||||
import { db } from "../db";
|
||||
import { sendEmailThroughSes } from "../ses";
|
||||
import { APP_SETTINGS } from "~/utils/constants";
|
||||
|
||||
export async function sendEmail(
|
||||
emailContent: EmailContent & { teamId: number }
|
||||
@@ -30,6 +31,10 @@ export async function sendEmail(
|
||||
text,
|
||||
html,
|
||||
region: domain.region,
|
||||
configurationSetName: getConfigurationSetName(
|
||||
domain.clickTracking,
|
||||
domain.openTracking
|
||||
),
|
||||
});
|
||||
|
||||
if (messageId) {
|
||||
@@ -47,3 +52,20 @@ export async function sendEmail(
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getConfigurationSetName(
|
||||
clickTracking: boolean,
|
||||
openTracking: boolean
|
||||
) {
|
||||
if (clickTracking && openTracking) {
|
||||
return APP_SETTINGS.SES_CONFIGURATION_FULL;
|
||||
}
|
||||
if (clickTracking) {
|
||||
return APP_SETTINGS.SES_CONFIGURATION_CLICK_TRACKING;
|
||||
}
|
||||
if (openTracking) {
|
||||
return APP_SETTINGS.SES_CONFIGURATION_OPEN_TRACKING;
|
||||
}
|
||||
|
||||
return APP_SETTINGS.SES_CONFIGURATION_GENERAL;
|
||||
}
|
||||
|
Reference in New Issue
Block a user