[INIT] Initial Project Structure
This commit is contained in:
commit
0fc5f05b6a
105 changed files with 10448 additions and 0 deletions
16
lib/util/mailing.ts
Normal file
16
lib/util/mailing.ts
Normal 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>` });
|
Loading…
Add table
Add a link
Reference in a new issue