Skip to content

Commit de34828

Browse files
committed
feat: send thank you email on contact
1 parent f1a64e2 commit de34828

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

apps/contact/app/(email-templates)/contact.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as React from "react";
22
import { Html, Heading } from "@react-email/components";
33

4-
export const ConactTemplate = () => {
4+
export const ContactTemplate = () => {
55
return (
66
<Html lang="en">
77
<Heading>Thank you for contacting us!</Heading>

apps/contact/app/(helpers)/email.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
import { render } from "@react-email/components";
22
import { createTransport } from "nodemailer";
33

4-
const { EMAIL_SERVER, EMAIL_FROM } = process.env;
4+
const { EMAIL_HOST, EMAIL_FROM, EMAIL_USERNAME, EMAIL_PASSWORD } = process.env;
55

6-
const transporter = createTransport(EMAIL_SERVER);
6+
const transporter = createTransport({
7+
host: EMAIL_HOST,
8+
port: 587,
9+
auth: {
10+
user: EMAIL_USERNAME,
11+
pass: EMAIL_PASSWORD,
12+
},
13+
});
714

815
export const sendEmail = async ({
916
template,
1017
options: { from, to, subject },
1118
}: {
1219
template: React.ReactNode;
1320
options: {
14-
from: string;
21+
from?: string;
1522
to: string;
1623
subject: string;
1724
};
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
//import { ContactTemplate } from "@/app/(email-templates)/contact";
2+
//import { sendEmail } from "@/app/(helpers)/email";
13
import { processContact } from "@/app/(helpers)/notion";
24
import { nanoid } from "nanoid";
35
import { NextRequest } from "next/server";
@@ -96,6 +98,11 @@ export async function POST(request: NextRequest) {
9698
source: request.nextUrl.searchParams.get("source") || "Unknown",
9799
});
98100

101+
/* await sendEmail({
102+
template: <ContactTemplate />,
103+
options: { to: email, subject: "Thank you for contacting us!" },
104+
}); */
105+
99106
return new Response(
100107
JSON.stringify({
101108
message: "Success",

0 commit comments

Comments
 (0)