Icon

Contact Forms for Next.js Websites

Build a working contact form for your Next.js website. Send Next.js form data to email using API in three simple steps. See example code below. No backend or server code needed.

Show steps ↓

No Signup required

No Backend Code

You already know! Setting up form backend is pain. Web3Forms works without any Server or backend code.

No Databases

All emails are sent directly to your email address. We never store your form submissions.

Design without Limits

Web3Forms is an API based form backend. We can seamlessly integrate to any custom design or style.

Create Next.js Contact Form

Creating Next.js Contact Form is easy as 1 2 3. Just follow the steps and you’re done.

1

Step 1: Create Access Key

Access key will be sent to your email address.

By submitting this form, you agree to our terms and privacy policy as well as give consent to reach you for marketing purposes.

2

Step 2: Create Next.js Form

Use the following code example to create a form inside your Next.js website.

export default function Contact() {
      async function handleSubmit(event) {
          event.preventDefault();
          const formData = new FormData(event.target);

          formData.append("access_key", "YOUR_ACCESS_KEY_HERE");

          const object = Object.fromEntries(formData);
          const json = JSON.stringify(object);

          const response = await fetch("https://api.web3forms.com/submit", {
              method: "POST",
              headers: {
                "Content-Type": "application/json",
                Accept: "application/json"
              },
              body: json
          });
          const result = await response.json();
          if (result.success) {
              console.log(result);
          }
      }

    return (
      <>
        <form onSubmit={handleSubmit}>
          <input type="text" name="name"/>
          <input type="email" name="email"/>
          <textarea name="message"></textarea>
          <button type="submit">Submit Form</button>
        </form>
      </>
    );
  }
3

Step 3: Add your Access Key

Replace the access key with your actual key to start receiving email submissions.

formData.append("access_key", "YOUR_ACCESS_KEY_HERE");
Next.js Docs & code examples →
← View all Platforms

Get Started!

Create your contact form for static website in minutes.

Create your Access Key

No Signup required