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
orformmail.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.