diff --git a/src/pages/api/contact.ts b/src/pages/api/contact.ts index e9928ca..90b6971 100644 --- a/src/pages/api/contact.ts +++ b/src/pages/api/contact.ts @@ -311,7 +311,17 @@ export const POST: APIRoute = async ({ request, clientAddress }) => { // Fire-and-forget: send email in background so the user gets an instant response. // Errors are logged/reported but never block the HTTP reply. + const recipientEmail = process.env.CONTACT_EMAIL_TO || 'unknown'; + console.log('Sending contact email to: ' + recipientEmail); + sendContactEmail(formData).catch(async (err) => { + console.error('Background email delivery failed:', { + recipient: recipientEmail, + email: formData.email, + subject: formData.subject, + error: err instanceof Error ? err.message : String(err), + stack: err instanceof Error ? err.stack : undefined, + }); logger.error('api.contact', 'Background email delivery failed', { email: formData.email, subject: formData.subject, @@ -334,7 +344,7 @@ export const POST: APIRoute = async ({ request, clientAddress }) => { return new Response( JSON.stringify({ success: true, - message: "Message received! We'll get back to you within 24 hours.", + message: 'Your message has been received. We will get back to you soon.', }), { status: 200, headers: rateLimitHeaders } );