Menu
Web Host Pro Logo
  • Home
  • News
  • Servers
  • Websites
  • WordPress
  • Business
Web Host Pro Logo
web host pro
May 29, 2014February 19, 2024

Simple formmail example

Share it here

Here is a simple cut-and-paste form with a couple variables you can change.

It uses Formmail already added to every web hosting account in your cPanel with Web Host Pro. You will need to have an email set up and working in the account you add the form to.

Here is the example and code (WordPress will not let us add the code here without it trying to change it)

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Contact Form</title>
</head>
<body>

    <h2>Contact Us</h2>

    <form action="http://yourdomain.com/cgi-bin/FormMail.pl" method="post">
        <input type="hidden" name="recipient" value="your@email.com">
        <input type="hidden" name="subject" value="Website Inquiry">
        <input type="hidden" name="redirect" value="http://yourdomain.com/thank-you.html">
        
        <label for="name">Name:</label><br>
        <input type="text" id="name" name="name" required><br>
        
        <label for="email">Email:</label><br>
        <input type="email" id="email" name="email" required><br>
        
        <label for="message">Message:</label><br>
        <textarea id="message" name="message" rows="4" required></textarea><br>
        
        <input type="submit" value="Send">
    </form>

</body>
</html>

Key Elements of the Form:

  • Action: This attribute should point to the URL of your FormMail script (e.g., FormMail.pl or formmail.cgi).
  • Method: The method post is used to submit form data as part of the HTTP request body, keeping it invisible in the URL.
  • Input Fields: The name attribute for each input field is crucial because FormMail uses these names to process the form data. Make sure they are correctly set and match what your FormMail script expects.
  • Hidden Fields:
    • recipient: The email address where you want the form data sent.
    • subject: The subject line for the email that’s generated.
    • redirect: The URL to redirect users to after the form is submitted successfully.

Security Note:

When using FormMail or any form-to-email script, it’s essential to ensure it’s configured securely to prevent abuse (e.g., spam). Many FormMail scripts have security features that need to be correctly set up. Always use the latest version of the script and follow the security guidelines provided by its developers.

Also, before deploying this form, make sure you have permission and the necessary rights to use FormMail or any similar scripts on your hosting server. Some hosting providers might restrict the use of such scripts due to security concerns.

Continue Reading

← Security Advisory: OpenSSL vulnerability (CVE-2014-0160)
Web hosting for PHP 5.3 →

Connect with us
WordPress

Web Host Pro websites, vps, and servers

Recent Posts

  • Free Website, DNS, Email, and Network Tools from Web Host Pro

    Free Website, DNS, Email, and Network Tools from Web Host Pro

  • The New Acronym Reshaping Big Tech in the AI Era

    The New Acronym Reshaping Big Tech in the AI Era

  • How to sell things online

    How to sell things online

  • The Rules for Success in 2026

    The Rules for Success in 2026

  • Cloud Hosting Explained

    Cloud Hosting Explained

  • Top 3 Myths About the Web Hosting Industry

    Top 3 Myths About the Web Hosting Industry

  • The New Era of Data Center Careers

    The New Era of Data Center Careers

  • Most popular web builder

    Most popular web builder

  • Do We Still Need “http://”?

    Do We Still Need “http://”?

  • How to Start a WordPress Blog in 2026

    How to Start a WordPress Blog in 2026

  • WordPress Load Control

    WordPress Load Control

  • How to Add Video to WordPress in 2026

    How to Add Video to WordPress in 2026

  • Mac vs PC in 2026

    Mac vs PC in 2026

  • Top 5 Reasons Websites Load Slow

    Top 5 Reasons Websites Load Slow

  • A Website Problem That Almost Derailed A Business

    A Website Problem That Almost Derailed A Business

Popular Posts

Log in
All Rights Reserved Web Host Pro 2001-2026