Add a contact form on DigitalOcean without fighting blocked SMTP ports
DigitalOcean blocks outbound SMTP ports on Droplets by default, which is why a mail function on your own server often fails silently. A contact form that posts to FormThunder avoids that, since the browser posts over HTTPS and FormThunder sends the email. This works on Droplets and App Platform static sites, and there's nothing to install on the server.
Updated
The DigitalOcean code
name: marketing-site
static_sites:
- name: web
github:
repo: YOUR_USER/YOUR_REPO
branch: main
build_command: npm run build
output_dir: dist
envs:
- key: VITE_FORMTHUNDER_KEY
value: YOUR_ACCESS_KEY
scope: BUILD_TIME<form action="https://formthunder.com/submit" method="POST">
<input type="hidden" name="access_key" value="YOUR_ACCESS_KEY">
<input type="hidden" name="subject" value="New message from the website">
<input type="checkbox" name="botcheck" style="display:none" tabindex="-1" autocomplete="off">
<label for="name">Name</label>
<input id="name" name="name" required>
<label for="email">Email</label>
<input id="email" name="email" type="email" required>
<label for="message">Message</label>
<textarea id="message" name="message" rows="5" required></textarea>
<button type="submit">Send</button>
</form>Replace YOUR_ACCESS_KEY with your free key. It's public by design, so it's safe in client code.
Notes for DigitalOcean
- On App Platform, a variable your build reads must have
BUILD_TIMEscope. ARUN_TIMEvariable doesn't exist during a static site's build. - On a Droplet, you don't need Postfix or an SMTP relay for this form. Serve the page with Nginx and that's all.
- App Platform's default
*.ondigitalocean.apphost differs from your custom domain, so list both if you use domain restriction.
Or have your AI add it
Connect the MCP server, then ask. The agent creates the form and writes the code for you, and it can send a real test when it's done.
Add a FormThunder contact form to this DigitalOcean site that emails hello@example.com. Send a test when you're done.Questions
Why doesn't my Droplet send email?
DigitalOcean blocks SMTP ports 25, 465 and 587 on Droplets by default. An HTTPS-based service gets around that.
Does this need anything installed on my server?
No. The form is plain HTML, and the post goes from the browser to FormThunder.
Get your DigitalOcean form sending
The free plan covers 250 submissions a month, with MCP, the CLI and the brand kit included.