summaryrefslogtreecommitdiff
path: root/src/lib/utils
diff options
context:
space:
mode:
authorElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-01-07 01:32:15 -0700
committerElizabeth Hunt <elizabeth.hunt@simponic.xyz>2024-01-07 01:32:15 -0700
commitb09e1e603287c5a29e336c0d4f2df8f28ef769a2 (patch)
tree5d6567ef17ba864e1f7df92b10b47f398f814089 /src/lib/utils
parentdb671d26c43e47b8285d319a0fd758df60d729c7 (diff)
downloadmistymountainstherapy-b09e1e603287c5a29e336c0d4f2df8f28ef769a2.tar.gz
mistymountainstherapy-b09e1e603287c5a29e336c0d4f2df8f28ef769a2.zip
make the text pretty
Diffstat (limited to 'src/lib/utils')
-rw-r--r--src/lib/utils/index.ts1
-rw-r--r--src/lib/utils/mailer.ts61
2 files changed, 0 insertions, 62 deletions
diff --git a/src/lib/utils/index.ts b/src/lib/utils/index.ts
index 61d383d..01aa9ef 100644
--- a/src/lib/utils/index.ts
+++ b/src/lib/utils/index.ts
@@ -1,3 +1,2 @@
export * from './setImageUrl';
-export * from './mailer';
export * from './retry';
diff --git a/src/lib/utils/mailer.ts b/src/lib/utils/mailer.ts
deleted file mode 100644
index e5edd74..0000000
--- a/src/lib/utils/mailer.ts
+++ /dev/null
@@ -1,61 +0,0 @@
-import * as nodemailer from 'nodemailer';
-import { continueRetryUntilValidation } from './retry';
-
-export interface Mailer {
- sendMail(to: string, subject: string, message: string): Promise<boolean>;
-}
-
-export class MistyMountainsMailer implements Mailer {
- private from: string;
- private domain: string;
- private username: string;
- private password: string;
- private port: number;
-
- private transporter: nodemailer.Transporter;
-
- constructor(username: string, password: string, from: string, domain: string, port: number) {
- this.from = from;
- this.username = username;
- this.password = password;
- this.domain = domain;
- this.port = port;
-
- this.transporter = nodemailer.createTransport({
- host: this.domain,
- port: this.port,
- auth: {
- user: this.username,
- pass: this.password
- },
- requireTLS: true,
- tls: {
- rejectUnauthorized: true
- }
- });
- }
-
- public async sendMail(to: string, subject: string, message: string) {
- const mail = {
- from: this.from,
- subject,
- html: message,
- to
- };
-
- return !!(await continueRetryUntilValidation<string>(async () => {
- const { messageId } = await this.transporter.sendMail(mail);
- return messageId;
- }));
- }
-}
-
-export const EnvMistyMountainsMailerFactory = () => {
- return new MistyMountainsMailer(
- process.env.SMTP_USERNAME,
- process.env.SMTP_PASSWORD,
- process.env.FROM_EMAIL,
- process.env.SMTP_SERVER,
- Number(process.env.SMTP_PORT)
- );
-};