Add a contact form to the resume #1
@@ -24,19 +24,19 @@ export const onRequest: PagesFunction<Env> = (context) => {
|
|||||||
if ((fullName || email) && message) {
|
if ((fullName || email) && message) {
|
||||||
try {
|
try {
|
||||||
const rawEmailMessage = `----
|
const rawEmailMessage = `----
|
||||||
From: Michael Pivato Contact Form <contact@michaelpivato.dev>
|
From: Michael Pivato Contact Form <contact@michaelpivato.dev>
|
||||||
To: Michael Pivato <contact@michaelpivato.dev>
|
To: Michael Pivato <contact@michaelpivato.dev>
|
||||||
Subject: Message from ${fullName ?? email}
|
Subject: Message from ${fullName ?? email}
|
||||||
|
|
||||||
You've received a new message from ${fullName ?? email}.
|
You've received a new message from ${fullName ?? email}.
|
||||||
Full Name: ${formatEmptyString(fullName)}
|
Full Name: ${formatEmptyString(fullName)}
|
||||||
Organisation: ${formatEmptyString(organisation)}
|
Organisation: ${formatEmptyString(organisation)}
|
||||||
Email: ${formatEmptyString(email)}
|
Email: ${formatEmptyString(email)}
|
||||||
Mobile: ${formatEmptyString(mobile)}
|
Mobile: ${formatEmptyString(mobile)}
|
||||||
|
|
||||||
Message:
|
Message:
|
||||||
${message}
|
${message}
|
||||||
----`;
|
----`;
|
||||||
await context.env.SERVICE.sendEmail(rawEmailMessage);
|
await context.env.SERVICE.sendEmail(rawEmailMessage);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return new Response(e);
|
return new Response(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user