updated bot

This commit is contained in:
2026-04-09 22:18:13 -05:00
parent b53ab78028
commit 8bf6445cf6
+13 -7
View File
@@ -30,12 +30,16 @@ export default {
} }
try { try {
await env.SEND_EMAIL.send({ if (env.SEND_EMAIL) {
from: `FEDL <[email protected]>`, await env.SEND_EMAIL.send({
to: body.to, from: `FEDL <[email protected]>`,
subject: body.subject, to: body.to,
text: body.text, subject: body.subject,
}); text: body.text,
});
} else {
throw new Error('SEND_EMAIL binding not configured. Go to Workers & Pages → your worker → Settings → Bindings to add it.');
}
return new Response(JSON.stringify({ ok: true }), { return new Response(JSON.stringify({ ok: true }), {
status: 200, status: 200,
@@ -55,6 +59,8 @@ export default {
} satisfies ExportedHandler<Env>; } satisfies ExportedHandler<Env>;
interface Env { interface Env {
SEND_EMAIL: any; SEND_EMAIL?: {
send(options: { from: string; to: string; subject: string; text: string }): Promise<void>;
};
FORWARD_TO: string; FORWARD_TO: string;
} }