Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion frontend/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@ NEXT_PUBLIC_CRYPTO_NETWORK=stellar-testnet
# Human support destination shown on error fallback states.
NEXT_PUBLIC_SUPPORT_EMAIL=support@example.com

# Resend API key for sending emails (optional)
RESEND_API_KEY=
# SDK base URL used by lib/config.ts. Defaults to MSW mock server in development.
NEXT_PUBLIC_SDK_URL=http://localhost:3000

# Public API key sent as x-api-key on SDK requests. Leave empty for local development.
NEXT_PUBLIC_API_KEY=
NEXT_PUBLIC_API_KEY=
41 changes: 41 additions & 0 deletions frontend/app/api/send-email/route.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import { NextResponse } from 'next/server'
import { Resend } from 'resend'

const resend = new Resend(process.env['RESEND_API_KEY'])

export async function POST(request: Request) {
const body = await request.json()
const { to, subject, html, text } = body

if (!to || !subject || (!html && !text)) {
return NextResponse.json(
{ error: 'Missing required fields: to, subject, and html or text' },
{ status: 400 }
)
}

if (!process.env['RESEND_API_KEY']) {
return NextResponse.json(
{ error: 'Email service not configured' },
{ status: 501 }
)
}

try {
const data = await resend.emails.send({
from: 'Bridgelet <onboarding@resend.dev>',
to,
subject,
html,
text
})

return NextResponse.json({ success: true, data })
} catch (error) {
console.error('Failed to send email:', error)
return NextResponse.json(
{ error: 'Failed to send email' },
{ status: 500 }
)
}
}
3 changes: 1 addition & 2 deletions frontend/components/send-form/steps/details-step.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,11 @@ export function DetailsStep({ state, onChange, onBack, onNext }: DetailsStepProp
<form onSubmit={handleSubmit} className="space-y-4" noValidate>
<div>
<label htmlFor="recipient-email" className="block text-sm font-medium text-slate-900">
Recipient email
Recipient email <span className="font-normal text-slate-500">(optional)</span>
</label>
<input
id="recipient-email"
type="email"
required
value={state.recipientEmail}
onChange={(e) => onChange({ recipientEmail: e.target.value })}
placeholder="recipient@example.com"
Expand Down
228 changes: 227 additions & 1 deletion frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
"@stellar/stellar-sdk": "^16.0.1",
"next": "^16.0.0",
"react": "^19.0.0",
"react-dom": "^19.0.0"
"react-dom": "^19.0.0",
"resend": "^6.16.0"
},
"devDependencies": {
"@playwright/test": "^1.61.1",
Expand Down
Loading