rebrand to useSend (#210)

This commit is contained in:
KM Koushik
2025-09-03 08:21:55 +10:00
committed by GitHub
parent b1a59d2705
commit 07c53d3f58
219 changed files with 1349 additions and 2835 deletions

View File

@@ -1,5 +1,5 @@
import { env } from "~/env";
import { Unsend } from "unsend";
import { UseSend } from "usesend";
import { isSelfHosted } from "~/utils/common";
import { db } from "./db";
import { getDomains } from "./service/domain-service";
@@ -7,13 +7,13 @@ import { sendEmail } from "./service/email-service";
import { logger } from "./logger/log";
import { renderOtpEmail, renderTeamInviteEmail } from "./email-templates";
let unsend: Unsend | undefined;
let usesend: UseSend | undefined;
const getClient = () => {
if (!unsend) {
unsend = new Unsend(env.UNSEND_API_KEY);
if (!usesend) {
usesend = new UseSend(env.USESEND_API_KEY ?? env.UNSEND_API_KEY);
}
return unsend;
return usesend;
};
export async function sendSignUpEmail(
@@ -28,7 +28,7 @@ export async function sendSignUpEmail(
return;
}
const subject = "Sign in to Unsend";
const subject = "Sign in to useSend";
// Use jsx-email template for beautiful HTML
const html = await renderOtpEmail({
@@ -38,7 +38,7 @@ export async function sendSignUpEmail(
});
// Fallback text version
const text = `Hey,\n\nYou can sign in to Unsend by clicking the below URL:\n${url}\n\nYou can also use this OTP: ${token}\n\nThanks,\nUnsend Team`;
const text = `Hey,\n\nYou can sign in to useSend by clicking the below URL:\n${url}\n\nYou can also use this OTP: ${token}\n\nThanks,\nuseSend Team`;
await sendMail(email, subject, text, html);
}
@@ -55,7 +55,7 @@ export async function sendTeamInviteEmail(
return;
}
const subject = "You have been invited to join Unsend";
const subject = "You have been invited to join useSend";
// Use jsx-email template for beautiful HTML
const html = await renderTeamInviteEmail({
@@ -64,7 +64,7 @@ export async function sendTeamInviteEmail(
});
// Fallback text version
const text = `Hey,\n\nYou have been invited to join the team ${teamName} on Unsend.\n\nYou can accept the invitation by clicking the below URL:\n${url}\n\nThanks,\nUnsend Team`;
const text = `Hey,\n\nYou have been invited to join the team ${teamName} on useSend.\n\nYou can accept the invitation by clicking the below URL:\n${url}\n\nThanks,\nuseSend Team`;
await sendMail(email, subject, text, html);
}
@@ -118,15 +118,15 @@ async function sendMail(
});
if (resp.data) {
logger.info("Email sent using unsend");
logger.info("Email sent using usesend");
return;
} else {
logger.error(
{ code: resp.error?.code, message: resp.error?.message },
"Error sending email using unsend, so fallback to resend"
"Error sending email using usesend, so fallback to resend"
);
}
} else {
throw new Error("UNSEND_API_KEY not found");
throw new Error("USESEND_API_KEY/UNSEND_API_KEY not found");
}
}