Immediately return in pages function when sending email through contact form
All checks were successful
release / Publish to Cloudflare Pages (push) Successful in 1m5s

This commit is contained in:
2025-02-13 22:45:02 +10:30
parent a8b511dabc
commit 75d5ed73dc

View File

@@ -29,13 +29,15 @@ export const onRequest: PagesFunction<Env> = (context) => {
// Must have some kind of identifiable information for me to actually care about them. // Must have some kind of identifiable information for me to actually care about them.
if ((fullName || email) && message) { if ((fullName || email) && message) {
try { try {
await context.env.SERVICE.sendEmail({ context.waitUntil(
fullName, context.env.SERVICE.sendEmail({
organisation, fullName,
email, organisation,
mobile, email,
message, mobile,
}); message,
})
);
} catch (e) { } catch (e) {
return new Response(e); return new Response(e);
} }