Skip to content

Commit 59e0810

Browse files
authored
Add error msg in case confirmation email fails
1 parent 0eb5033 commit 59e0810

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

index.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,10 @@ async function handleRequest(request) {
127127

128128
// If we get here, we managed to sign up for the lists
129129
const sendmailresponse = await sendConfirmationEmail(bodydata.address, bodydata.name, listsToSubscribeTo)
130-
return new Response("Successfully signed up for the mailing lists", {status:200, headers:corsHeaders})
130+
if( sendmailresponse.status != 200 ) {
131+
return new Response("You were signed up, but sending a confirmation email failed.", {status:sendmailresponse.status, headers:corsHeaders})
132+
}
133+
return new Response("Succesfully subscribed. You will receive a confirmation email.", {status:200, headers:corsHeaders})
131134
}
132135
}
133136
}

0 commit comments

Comments
 (0)