send.webforms.toRead the docs →

Template marketplaces

Make a TemplateMonster template's contact form work

Short answer

Many TemplateMonster HTML templates use RD Mailform, which posts to bat/rd-mailform.php and only counts a reply of MF000 as success. Set the form action to your WebForms endpoint, remove the rd-mailform class so its script stops handling the form, and add a short fetch script. Submissions then arrive by email with no PHP.

If your template's contact form has the class rd-mailform and a bat/ folder, it uses RD Mailform: a PHPMailer script configured in bat/rd-mailform.config.json, and a script that shows "Successfully sent!" only when the server replies with the code MF000. Any other reply shows "Aw, snap! Something went wrong", even when the message was sent. Swapping it for WebForms takes a few minutes and needs no PHP or SMTP settings.

Get an endpointRead the docs

Setup

  1. Create a form and copy its endpoint

    Sign up, create a form, and copy the endpoint URL. Submissions are emailed to your verified address by default.

  2. Change the form

    Find <form class="rd-mailform" ... action="bat/rd-mailform.php">. Set action to your endpoint and remove rd-mailform from the class list, so the template's script no longer intercepts it. Keep the other classes so the styling stays.

  3. Add the submit script

    Paste the short fetch script below at the end of the page. It sends the form, asks WebForms for JSON, and shows the message it gets back in the form's output element.

  4. Remove the bat folder

    Delete bat/rd-mailform.php, its config and the PHPMailer files. They are no longer used, and the config file may hold SMTP credentials you do not want published.

  5. Send a test

    Submit the form on the live site; it appears in your inbox and the dashboard within seconds.

TemplateMonster examples

Swap in your own endpoint and these run as-is.

contacts.html
<!-- Before -->
<form class="rd-mailform" data-form-output="form-output-global"
      data-form-type="contact" method="post" action="bat/rd-mailform.php">

<!-- After: rd-mailform class removed, action is your endpoint -->
<form class="contact-form" id="contact-form" method="post"
      action="https://send.webforms.to/wft_your_key">

Add before `</body>`:

contacts.html
<!-- Replaces the template's form script entirely -->
<script>
document.querySelector("#contact-form").addEventListener("submit", async (e) => {
  e.preventDefault();
  const form = e.target;
  const out = form.querySelector(".form-message") ?? form.appendChild(document.createElement("p"));
  const body = new FormData(form);
  // So "Reply" on the notification email goes to the visitor.
  if (body.get("email")) body.set("_replyto", body.get("email"));
  const res = await fetch(form.action, {
    method: "POST",
    body,
    headers: { Accept: "application/json" },
  });
  const data = await res.json().catch(() => ({ ok: false }));
  out.textContent = data.ok ? data.message : "Sorry, something went wrong. Please try again.";
  if (data.ok) form.reset();
});
</script>

What RD Mailform's error codes mean

RD Mailform's script reads a five character code from the server and shows the matching message. Seeing one of these usually means the PHP side failed:

Why the template's contact form does not send

Most marketplace HTML templates post the form to a PHP file that ships with the template, such as contact.php, mail.php, php/contact-form.php or bat/rd-mailform.php. That script calls PHP's mail function or PHPMailer to send you an email. It only works on a server that runs PHP and is allowed to send mail.

Static hosting runs no PHP at all, so on hosts like GitHub Pages and Netlify the POST fails, often with 405 Not Allowed. Some cloud providers, DigitalOcean among them, block outgoing mail ports by default. Shared hosting that does run PHP can still send these emails to spam, because they come from the web server rather than a real mail domain.

Pointing the form at a WebForms endpoint removes the PHP step. The submission goes to WebForms, which checks it for spam, stores it, and emails it to you, or sends it to Slack, Discord, Telegram or a webhook on Pro.

Worth knowing

TemplateMonster form FAQ

It is RD Mailform's code MF255: the script got a reply that was not one of its codes, usually because PHP is not running or failed. Replacing RD Mailform with a WebForms endpoint removes the PHP step.

Where TemplateMonster submissions can go

The guide above gets the submission to your endpoint. From there it can land anywhere: one destination on Free, several on Pro.

Need the form markup too? The template gallery has complete forms for contact, waitlist, job application and more, and the form generator builds one field by field.

Ready to wire up your TemplateMonster form?

Free for 300 submissions a month. Endpoint in under a minute, no card required.

Start free