-
Notifications
You must be signed in to change notification settings - Fork 0
Mac 239 setup resend emails #17
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
a405019
fc654b8
1358792
392f614
403e054
aa9a659
f080e06
2ac7c7c
3ddd1c1
9840960
f3dda9b
1f7cdb3
5b9a4bb
8323bd4
6f31601
edf5957
b908658
37a08ec
b01440b
7bf9e03
ef48664
e585590
e679c5f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| import { EmailTemplate } from '../../../components/EmailTemplate'; | ||
| import { Resend } from 'resend'; | ||
|
|
||
| const resend = new Resend(process.env.RESEND_API_KEY); | ||
|
||
|
|
||
| export async function POST(req: Request) { | ||
| try { | ||
| // Get the form data from the request | ||
| const { name, emailAddress, subject, message } = await req.json(); | ||
|
|
||
| const { data, error } = await resend.emails.send({ | ||
| from: 'noreply@monashcoding.com', | ||
| // to: 'coding@monashclubs.org', | ||
| to: 'projects@monashcoding.com', | ||
| replyTo: emailAddress, // User's email will be set as reply-to | ||
| subject: subject || 'New Message from Monash Coding Site', | ||
| react: EmailTemplate({ name, emailAddress, subject, message }), | ||
|
stevenphanny marked this conversation as resolved.
Outdated
|
||
| }); | ||
|
|
||
| if (error) { | ||
| console.error('Resend API error:', error); | ||
| return Response.json({ error }, { status: 500 }); | ||
| } | ||
|
|
||
| return Response.json(data); | ||
| } catch (error) { | ||
| console.error('Catch error:', error); | ||
| return Response.json({ error: String(error) }, { status: 500 }); | ||
| } | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.