Platform Guide

Neocities Contact Form

Add a contact form that emails you to a Neocities site

Last updated

To add a contact form to a Neocities site, create a contact.html page with the form below and upload it with your other files. The form posts to https://api.staticforms.dev/submit with your form's API key, and Static Forms emails each submission to you. The page needs no server-side code and no JavaScript, and it works on the Static Forms free plan.

1. Copy the page

Replace YOUR_API_KEY with the key from the General tab of your form in the app, and YOUR-SITE with your Neocities site name. The key is visible in the page, which is expected: the form API key cannot read submissions.

contact.html

The visitor's email field becomes the reply-to address on the notification, and every other named field appears in the email. redirectTo must be a full URL. Without it, the visitor sees a plain confirmation from Static Forms instead of your own page.

2. Add the thank-you page

Create a second file, thanks.html, for the page the visitor lands on after sending.

thanks.html

3. Upload both files

The steps below are from how the Neocities dashboard works as we know it. We have not checked them against Neocities' help pages, so if your dashboard looks different, use its own upload option for the two files.

1

Open your dashboard

Sign in to Neocities and open your site's dashboard.

2

Add the files

Create contact.html and thanks.html in the dashboard's file list and paste the code into each, or upload the two files from your computer.

3

Link to the contact page

Add <a href="/contact.html">Contact</a> to your home page or navigation.

Neocities lists html among the file types a free account can upload, so both pages work without a supporter plan. See the allowed file types on Neocities.

4. Test it

Open /contact.html on your live site, send a message and check that you land on the thank-you page. The message arrives by email and is listed in the Inbox in the app.

Spam protection

Every submission goes through the built-in spam filter, and the honeypot field catches bots that fill in every field. CAPTCHA widgets and their field names are in the plain HTML guide. A longer walkthrough is in the Neocities contact form tutorial.

Troubleshooting

What you seeWhy, and what to do
401 "Invalid API key"Check that the apiKey value matches the key on the form's General tab, with no extra spaces.
The visitor sees a plain confirmation, not your pageThe redirectTo value is missing or is not a full https:// URL.
A field is missing from the emailGive the input a name attribute.
403 "Submission rejected: Domain … is not in the allowed domains list"Domain restriction is on and your site is not listed. Add your-site.neocities.org, or your custom domain, on the form's security settings.
No email arrivesCheck your spam folder, then the Inbox in the app: if the submission is listed, the problem is delivery.

FAQ

Does this work on the free plan?

Yes. The snippet only uses Free plan features: 250 submissions every 30 days, 1 form endpoint, email delivery, the built-in spam filter, a honeypot field and reCAPTCHA v2. No credit card is needed.

How do I keep spam out?

Every submission is checked by the built-in spam filter on every plan. The snippet adds a hidden honeypot field (any field whose name contains "honeypot"); bots fill it in and those submissions are dropped. reCAPTCHA v2 is available on Free. Cloudflare Turnstile, hCaptcha, ALTCHA and reCAPTCHA v3 are available from the Starter plan.

Is it safe to put the API key in my HTML?

Yes. The form API key is meant to be public. It cannot read your submissions or sign in to your dashboard. From the Starter plan you can also restrict submissions to your own domains.

Do I need PHP or a server on Neocities?

No. The browser posts the form straight to https://api.staticforms.dev/submit, so your site only needs the two HTML files.