This repository has been archived by the owner on Jul 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from detrash/feat/support-email
feat: add resend and create support route
- Loading branch information
Showing
4 changed files
with
255 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,7 @@ AUTH0_BASE_URL= | |
AUTH0_ISSUER_DOMAIN= | ||
AUTH0_CLIENT_SECRET= | ||
AUTH0_CLIENT_ID= | ||
|
||
|
||
# Emails | ||
RESEND_API_KEY= |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { Resend } from 'resend'; | ||
|
||
const resend = new Resend(process.env.RESEND_API_KEY); | ||
|
||
export async function POST(req: Request) { | ||
const { email } = await req.json(); | ||
|
||
try { | ||
const { data, error } = await resend.emails.send({ | ||
from: '[email protected]', | ||
to: ['[email protected]', '[email protected]'], | ||
subject: 'I want a personalized support', | ||
html: `<strong>Email:</strong> ${email}`, | ||
}); | ||
|
||
if (error) { | ||
return Response.json({ error }, { status: 500 }); | ||
} | ||
|
||
return Response.json(data); | ||
} catch (error) { | ||
return Response.json({ error }, { status: 500 }); | ||
} | ||
} |
Oops, something went wrong.