neverstew-emailhole.web.val.run
Readme

️📨🕳️

It's the last fifteen minutes of fame for your emails (unless a new email arrives...)

Send your landing page signups, WiFi sign-ins and other junk here to never be troubled again.

Got a sensitive one? No problem, just send yourself another email!

Playground

Email me!

Get Your Own

database migrations

email handler

cleanup

Steps

Fork this and the two vals above. Then, run the database migrations in order.

Troublemakers could just use this one...

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import { Statement } from "https://esm.town/v/postpostscript/sqliteBuilder?v=36";
const DEFAULT = `
<!DOCTYPE html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
</head>
<body>
NO EMAILS IN LAST 15 MINUTES<br>
<a href='mailto:neverstew.peachGoat@valtown.email'>Email me!</a>
</body>
</html>
`;
export default async function(req: Request): Promise<Response> {
const now = new Date().getTime();
const fifteenMins = 15 * 60 * 1000;
const [latestEmail] = await Statement`select * from emails where timestamp > ${
now - fifteenMins
} order by timestamp desc limit 1`.execute();
return new Response(latestEmail?.content || DEFAULT, { headers: { "Content-Type": "text/html" } });
}
Val Town is a social website to write and deploy JavaScript.
Build APIs and schedule functions from your browser.
Comments
Nobody has commented on this val yet: be the first!
April 26, 2024