fix: remove isPersonalEmail logic

This commit is contained in:
Rotimi Best
2024-09-23 21:18:33 +01:00
parent eaf078d8e2
commit 7c9b7bb920
5 changed files with 8 additions and 10 deletions
+2 -3
View File
@@ -12,7 +12,7 @@ nodemailerTransporter().then((t) => {
}); });
async function sendWithNodemailer(emailData) { async function sendWithNodemailer(emailData) {
const { from, to, subject, content, isPersonalEmail, replyTo } = emailData; const { from, to, subject, content, replyTo } = emailData;
if (!transporter) { if (!transporter) {
return; return;
@@ -74,7 +74,6 @@ emailRouter.post('/', async (req, res) => {
to: zod.string(), to: zod.string(),
subject: zod.string(), subject: zod.string(),
content: zod.string(), content: zod.string(),
isPersonalEmail: zod.boolean().optional(),
replyTo: zod.string().optional() replyTo: zod.string().optional()
}) })
); );
@@ -88,7 +87,7 @@ emailRouter.post('/', async (req, res) => {
let res; let res;
try { try {
if (emailData.isPersonalEmail || !ZOHO_TOKEN) { if (!ZOHO_TOKEN) {
res = await sendWithNodemailer(emailData); res = await sendWithNodemailer(emailData);
} else { } else {
res = await sendWithZoho(emailData); res = await sendWithZoho(emailData);
@@ -30,7 +30,6 @@ const sendEmailNotification = async (feedId: string, authorId: string, comment?:
<a class="button" href="${postLink}">View comment</a> <a class="button" href="${postLink}">View comment</a>
</div> </div>
`, `,
isPersonalEmail: false,
replyTo: '[email protected]' replyTo: '[email protected]'
} }
]; ];
@@ -44,6 +44,7 @@ export async function POST({ request }) {
const emailData = [ const emailData = [
{ {
from: `"Best from ClassroomIO" <[email protected]>`,
to: email, to: email,
subject: `Join ${name} on ClassroomIO 😃`, subject: `Join ${name} on ClassroomIO 😃`,
content: ` content: `
@@ -52,8 +53,7 @@ export async function POST({ request }) {
<div> <div>
<a class="button" href="${inviteLink}">Accept Invitation</a> <a class="button" href="${inviteLink}">Accept Invitation</a>
</div> </div>
`, `
isPersonalEmail: true
} }
]; ];
await sendEmail(emailData); await sendEmail(emailData);
@@ -37,6 +37,7 @@ export async function POST({ request }) {
const emailData = [ const emailData = [
{ {
from: `"Best from ClassroomIO" <[email protected]>`,
to, to,
subject: 'Action Required: Confirm your email', subject: 'Action Required: Confirm your email',
content: ` content: `
@@ -47,8 +48,7 @@ export async function POST({ request }) {
<div> <div>
<a class="button" href="${verificationLink}">Verify</a> <a class="button" href="${verificationLink}">Verify</a>
</div> </div>
`, `
isPersonalEmail: true
} }
]; ];
@@ -27,6 +27,7 @@ export async function POST({ request }) {
const emailData = [ const emailData = [
{ {
from: `"Best from ClassroomIO" <[email protected]>`,
to, to,
subject: 'Welcome to ClassroomIO!', subject: 'Welcome to ClassroomIO!',
content: ` content: `
@@ -44,8 +45,7 @@ export async function POST({ request }) {
<p> <p>
PS: I reply personally to every email. We don't have an outsourced support team at the other end of the globe.. ;-) PS: I reply personally to every email. We don't have an outsourced support team at the other end of the globe.. ;-)
</p> </p>
`, `
isPersonalEmail: true
} }
]; ];