Limited-time offer The first 2,000 users get 10,000 emails/month free forever 2,000 of 2,000 spots left Claim yours

Guides

Add a contact form to GitHub Pages

GitHub Pages serves static files only, so a form has nowhere to post. Point it at FormSMTP instead: no Actions, no functions, no secrets in the repo.

Last updated October 25, 2026

1Create a FormSMTP project

Sign up free and add a project. Pick your email provider so the SMTP host and port fill in, enter your login, and click Test connection. Not sure which provider? Your existing mailbox works: see the Gmail or Zoho guides.

2Lock the project to your site

In Settings → Security, set Allowed websites to https://yourname.github.io and Allowed recipients to your own address. Now the key in your page can only email you, only from your site, and only up to your hourly limit.

Using a custom domain? Add both https://yourdomain.com and https://yourname.github.io to Allowed websites.

3Add the form to your site

Plain HTML site: paste into index.html or contact.html. Jekyll: save it as _includes/contact-form.html and use {% include contact-form.html %} in any page.

html
<form action="https://app.formsmtp.com/api/v1/form/YOUR_API_KEY" method="POST">
  <label>Name <input name="name" required></label>
  <label>Email <input name="email" type="email" required></label>
  <label>Message <textarea name="message" rows="5" required></textarea></label>

  <input type="hidden" name="_subject" value="New message from my website">
  <!-- Honeypot: hidden from people, irresistible to bots -->
  <input type="text" name="_gotcha" style="display:none" tabindex="-1" autocomplete="off">

  <button type="submit">Send message</button>
</form>

4Commit and push

bash
git add contact.html
git commit -m "Add contact form"
git push

GitHub Pages rebuilds in about a minute. Submit the form on the live site and check your inbox and the FormSMTP logs.

FAQ

Can GitHub Pages send email?

Not on its own: it can’t run server code. A form backend receives the submission over HTTPS and sends the email for you.

Will my API key be public in the repository?

Yes, like any key in front-end code. That’s fine here: form submissions only go to you, and you can lock the key to your github.io domain with an hourly limit.

Why did my message land in spam?

Usually the From address and the SMTP account don’t match, or the domain has no SPF/DKIM records. Send from the address you log in with, and check the Deliverability panel in FormSMTP’s Settings.

More guides

Ship your form in five minutes

Connect the SMTP account you already have, copy one snippet, done. Free, no card.