Form_To_Mail: Example Code

This code can be cut and pasted straight into your HTML page; all you need to do is modify the hidden variables:

And set the '' part of the <form> tag to your web address.

If you are using MS Frontpage, Macromedia Dreamweaver, Adobe GoLive or another web development application, please ensure you paste this code into the HTML code window.

N.B. You do not require to upload your own version of form_to_mail.php, the server will automatically load our version.

-------------- Highlight the following code, then copy & paste it into your page -------------

<title>Example Form</title>


<!-- Begin the form. Change "" to your web address throughout this file. -->
<form method="post" action="">
<!-- Basic styling; set the width and the maximum width of your form below --> <style> :root { --width: 100%; --max-width: 600px; } .item { width: var(--width); max-width: var(--max-width); box-sizing: border-box; } .buttons { width: var(--width); max-width: var(--max-width); display: flex; flex-wrap: wrap; flex-direction: row-reverse; justify-content: space-between; } </style> <!-- Who to send this form to. Add your e-mail address here. --> <input type="hidden" name="recipient" value="your_email_address_here"> <!-- Where you want your mail to appear as having been sent from (this must be a valid Freeola hosted e-mail address) --> <input type="hidden" name="from" value="your_form@your_domainname_here"> <!-- Set a subject for the form for your reference --> <input type="hidden" name="subject" value="Comments"> <!-- List of required fields, separated by commas --> <input type="hidden" name="require" value="name,e-mail,message"> <!-- Success redirect - where to go after the form has been sent --> <input type="hidden" name="success_redirect" value=""> <!-- Display our form --> <label for="name" class="item" >Name:</label><br>
<input class="item" type="text" id="name" name="name"><br>
<label class="item" for="e-mail" >E-mail:</label><br>
<input class="item" type="text" id="e-mail" name="e-mail"><br>
<label class="item" for="message" >Message:</label><br>
<textarea class="item" rows="7" id="message" name="message"></textarea><br>
<div class="buttons"> <button type="submit" name="submit" value="Send">Send</button> <button type="reset" name="reset" value="Reset">Reset</button> </div>
<!-- Close form tag --> </form>
<!-- Close body -->

<!-- End of page -->