Immediately return in pages function when sending email through contact form
All checks were successful
release / Publish to Cloudflare Pages (push) Successful in 1m5s
All checks were successful
release / Publish to Cloudflare Pages (push) Successful in 1m5s
This commit is contained in:
@@ -29,13 +29,15 @@ export const onRequest: PagesFunction<Env> = (context) => {
|
||||
// Must have some kind of identifiable information for me to actually care about them.
|
||||
if ((fullName || email) && message) {
|
||||
try {
|
||||
await context.env.SERVICE.sendEmail({
|
||||
context.waitUntil(
|
||||
context.env.SERVICE.sendEmail({
|
||||
fullName,
|
||||
organisation,
|
||||
email,
|
||||
mobile,
|
||||
message,
|
||||
});
|
||||
})
|
||||
);
|
||||
} catch (e) {
|
||||
return new Response(e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user