[INIT] Initial Project Structure
Some checks failed
Deploy Edge / deploy-edge (push) Failing after 2s
S3 Repo Backup / s3-repo-backup (push) Failing after 2s

This commit is contained in:
Dunemask 2024-08-24 12:41:04 -06:00
commit 0fc5f05b6a
105 changed files with 10448 additions and 0 deletions

16
lib/util/mailing.ts Normal file
View file

@ -0,0 +1,16 @@
import sgMail from "@sendgrid/mail";
const { CAIRO_BOT_EMAIL: botEmail, CAIRO_SENDGRID_KEY: sendgridApiKey } = process.env;
// Configure API Key
sgMail.setApiKey(sendgridApiKey ?? "");
if (!botEmail && !!sendgridApiKey) throw Error("Bot Email wasn't defined but API key was!");
const from = botEmail ?? "donotreply@dunemask.dev";
const ignoreMessage = `If you did not sign up for a cairo account, please ignore this email!`;
export const sendMessage = (to: string, subject: string, text: string) =>
sgMail.send({ from, to, subject, text: text + `\n${ignoreMessage}` });
export const sendHtml = (to: string, subject: string, html: string) =>
sgMail.send({ from, to, subject, html: html + `<p>${ignoreMessage}</p>` });