mirror of
https://github.com/lukevella/rallly.git
synced 2025-07-18 00:37:27 +02:00
📢 Add a feedback form (#590)
This commit is contained in:
parent
ef1fd25a7c
commit
e8fd472ef6
10 changed files with 177 additions and 3 deletions
|
@ -2,6 +2,7 @@ import * as aws from "@aws-sdk/client-ses";
|
|||
import { defaultProvider } from "@aws-sdk/credential-provider-node";
|
||||
import { render } from "@react-email/render";
|
||||
import { createTransport, Transporter } from "nodemailer";
|
||||
import type Mail from "nodemailer/lib/mailer";
|
||||
import React from "react";
|
||||
|
||||
import * as templates from "./templates";
|
||||
|
@ -81,11 +82,10 @@ export const sendEmail = async <T extends TemplateName>(
|
|||
return;
|
||||
}
|
||||
|
||||
const transport = getTransport();
|
||||
const Template = templates[templateName] as TemplateComponent<T>;
|
||||
|
||||
try {
|
||||
await transport.sendMail({
|
||||
await sendRawEmail({
|
||||
from: {
|
||||
name: "Rallly",
|
||||
address: process.env.SUPPORT_EMAIL,
|
||||
|
@ -101,3 +101,13 @@ export const sendEmail = async <T extends TemplateName>(
|
|||
options.onError?.();
|
||||
}
|
||||
};
|
||||
|
||||
export const sendRawEmail = async (options: Mail.Options) => {
|
||||
const transport = getTransport();
|
||||
try {
|
||||
await transport.sendMail(options);
|
||||
return;
|
||||
} catch (e) {
|
||||
console.error("Error sending email");
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue